summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc/snippets/code')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp
index 0580f142d7..da17b390fd 100644
--- a/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_thread_qfuture.cpp
@@ -220,3 +220,35 @@ QtFuture::connect(&object, &Object::singleArgSignal).then([](int value) {
// handle other exceptions
});
//! [14]
+
+//! [15]
+QFuture<int> testFuture = ...;
+auto resultFuture = testFuture.then([](int res) {
+ // Block 1
+}).onCanceled([] {
+ // Block 2
+}).onFailed([] {
+ // Block 3
+}).then([] {
+ // Block 4
+}).onFailed([] {
+ // Block 5
+}).onCanceled([] {
+ // Block 6
+});
+//! [15]
+
+//! [16]
+QFuture<int> testFuture = ...;
+auto resultFuture = testFuture.then([](int res) {
+ // Block 1
+}).onFailed([] {
+ // Block 3
+}).then([] {
+ // Block 4
+}).onFailed([] {
+ // Block 5
+}).onCanceled([] {
+ // Block 6
+});
+//! [16]