Created
March 24, 2018 09:21
-
-
Save estan/80184b53b7b7120eefb9f0f6b608d000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int someParam = 1; | |
auto future = QtConcurrent::run(doHeavyStuff); | |
auto watcher = new QFutureWatcher<ResultType>(this); | |
connect(watcher, &QFutureWatcher<ResultType>::finished, [future, someParam]() { | |
// Do stuff here, you have the return value of doHeavyStuff in future.result()... | |
}); | |
connect(watcher, &QFutureWatcher<ResultType>::finished, | |
watcher, &QFutureWatcher<ResultType>::deleteLater); | |
watcher->setFuture(future); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment