aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp')
-rw-r--r--doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp b/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp
new file mode 100644
index 000000000..e1f06ccc2
--- /dev/null
+++ b/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp
@@ -0,0 +1,10 @@
+//! [0]
+// Instantiate the objects and connect to the finished signal.
+MyClass myObject;
+QFutureWatcher<int> watcher;
+connect(&watcher, SIGNAL(finished()), &myObject, SLOT(handleFinished()));
+
+// Start the computation.
+QFuture<int> future = QtConcurrent::run(...);
+watcher.setFuture(future);
+//! [0]