summaryrefslogtreecommitdiffstats
path: root/src/concurrent/doc/snippets/code
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-12-22 13:06:25 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-24 10:04:56 +0000
commitb02ed9696f88d4e44b6e03265c2aa8f41506cf5c (patch)
tree63b69f1bd82a1446966d6580cef7427119319ae8 /src/concurrent/doc/snippets/code
parentb14a33ff671b555b3677a012867489e174cb98e7 (diff)
Document that QtConcurrent::run doesn't support overloaded functions
After improving QtConcurrent::run() to use parameter packs for the arguments (see c977e74afd18afff8729070f631e6b7a3f2887f5), calling overloaded functions is ambiguous. Updated the porting guide and the documentation to mention this and describe possible workarounds. Task-number: QTBUG-89648 Change-Id: I4c1f996ae67bce8c13cc1f99f54240295db6ae1d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit f1f4fd16fdd219701261d305e6d9f7abcb8bf4a9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/concurrent/doc/snippets/code')
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
index bf39119c51..59b65dcb3a 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
@@ -230,3 +230,21 @@ run<double>(f); // this will select the 2nd overload
// run(f); // error, both candidate overloads potentially match
//! [14]
+//! [15]
+void foo(int arg);
+void foo(int arg1, int arg2);
+...
+QFuture<void> future = QtConcurrent::run(foo, 42);
+//! [15]
+
+//! [16]
+QFuture<void> future = QtConcurrent::run([] { foo(42); });
+//! [16]
+
+//! [17]
+QFuture<void> future = QtConcurrent::run(static_cast<void(*)(int)>(foo), 42);
+//! [17]
+
+//! [18]
+QFuture<void> future = QtConcurrent::run(qOverload<int>(foo), 42);
+//! [18]