19 #include <QFutureWatcher>
20 #include <QProgressDialog>
24 #include <QtConcurrent>
41 QProgressDialog dialog(label, {}, 0, 0);
42 dialog.setWindowModality(Qt::ApplicationModal);
43 dialog.setWindowTitle(title);
44 dialog.setMinimumDuration(250);
48 std::exception_ptr exception;
50 auto future = QtConcurrent::run([&]() -> T {
57 exception = std::current_exception();
62 QFutureWatcher<T> watcher;
65 QObject::connect(&watcher, &QFutureWatcher<T>::finished, [&]() {
66 result = watcher.result();
71 watcher.setFuture(future);
75 std::rethrow_exception(exception);