Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
QmitkRun.h File Reference
#include <MitkQtWidgetsExports.h>
#include <QEventLoop>
#include <QFutureWatcher>
#include <QProgressDialog>
#include <QString>
#include <QWidget>
#include <QtConcurrent>
#include <exception>
#include <functional>

Go to the source code of this file.

Functions

template<typename T >
QmitkRunAsyncBlocking (const QString &title, const QString &label, std::function< T()> task)
 Runs a long task in a background thread while keeping the UI responsive. More...
 
MITKQTWIDGETS_EXPORT void QmitkRunAsyncBlocking (const QString &title, const QString &label, std::function< void()> task)
 

Function Documentation

◆ QmitkRunAsyncBlocking() [1/2]

template<typename T >
T QmitkRunAsyncBlocking ( const QString &  title,
const QString &  label,
std::function< T()>  task 
)

Runs a long task in a background thread while keeping the UI responsive.

The function blocks until the task finishes, using a QEventLoop to process events and prevent the UI from freezing.

While the task is running, a QProgressDialog is shown with a delay of 250ms.

Exceptions are caught in the background thread and rethrown in the calling thread.

Definition at line 39 of file QmitkRun.h.

◆ QmitkRunAsyncBlocking() [2/2]

MITKQTWIDGETS_EXPORT void QmitkRunAsyncBlocking ( const QString &  title,
const QString &  label,
std::function< void()>  task 
)