Commit 1ffd0383 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

Merge branch 'feature-fix-nomainwindow-app-crash' into develop

parents 9e396dd6 49c4d89c
......@@ -266,42 +266,57 @@ void Application::refresh() {
// ----------------- showStatusBarMessage --------------------
void Application::showStatusBarMessage(QString msg, int timeout) {
QStatusBar * statusBar = mainWindow->statusBar();
// if this application has no main window (no GUI)
// there is no status bar, therefore nothing to do
if (mainWindow) {
QStatusBar * statusBar = mainWindow->statusBar();
if (statusBar) {
statusBar->showMessage(msg, timeout);
} else {
CAMITK_INFO("Application", "showStatusBarMessage", msg.toStdString() << std::endl);
if (statusBar) {
statusBar->showMessage(msg, timeout);
} else {
CAMITK_INFO("Application", "showStatusBarMessage", msg.toStdString() << std::endl);
}
}
}
// ----------------- resetProgressBar --------------------
void Application::resetProgressBar() {
QProgressBar * progress = mainWindow->getProgressBar();
// if this application has no main window (no GUI)
// there is no status bar, therefore nothing to do
if (mainWindow) {
QProgressBar * progress = mainWindow->getProgressBar();
if (progress) {
progress->setValue(0);
if (progress) {
progress->setValue(0);
}
}
}
// ----------------- setProgressBarValue --------------------
void Application::setProgressBarValue(int value) {
QProgressBar * progress = mainWindow->getProgressBar();
// if this application has no main window (no GUI)
// there is no status bar, therefore nothing to do
if (mainWindow) {
QProgressBar * progress = mainWindow->getProgressBar();
if (progress) {
progress->setValue(value);
if (progress) {
progress->setValue(value);
}
}
}
// ----------------- vtkProgressFunction --------------------
void Application::vtkProgressFunction(vtkObject * caller, long unsigned int eventId, void * clientData, void * callData) {
QProgressBar * progress = mainWindow->getProgressBar();
vtkAlgorithm * filter = static_cast<vtkAlgorithm *>(caller);
int progressVal = filter->GetProgress() * 100;
if (progress) {
progress->setValue(progressVal);
// if this application has no main window (no GUI)
// there is no status bar, therefore nothing to do
if (mainWindow) {
QProgressBar * progress = mainWindow->getProgressBar();
vtkAlgorithm * filter = static_cast<vtkAlgorithm *>(caller);
int progressVal = filter->GetProgress() * 100;
if (progress) {
progress->setValue(progressVal);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment