24QFuture<
void>
future = QtConcurrent::run(aFunctionWithArguments, integer, floatingPoint, string);
43QString result = future.result();
51QList<QByteArray> result = future.result();
57QFuture<
void>
future = QtConcurrent::run(&QImage::invertPixels, &image, QImage::InvertRgba);
71static void addOne(
int &n) { ++n; }
74QtConcurrent::run(&addOne, std::ref(n)).waitForFinished();
89QtConcurrent::run(std::ref(o), 15).waitForFinished();
92QtConcurrent::run(o, 42).waitForFinished();
95QtConcurrent::run(TestClass(), 42).waitForFinished();
98QtConcurrent::run(&o, 42).waitForFinished();
107extern void aFunction(QPromise<
void> &promise,
int arg1,
const QString &arg2);
112QFuture<
void>
future = QtConcurrent::run(aFunction, integer, string);
118 promise.addResult(
"Hello");
119 promise.addResult(
"world");
124QList<QString> results = future.results();
130 for (
int i = 0; i < 100; ++i) {
131 promise.suspendIfRequested();
132 if (promise.isCanceled())
136 const int res = ... ;
137 promise.addResult(res);
156 promise.setProgressRange(0, 100);
158 for (
int i = 0; i < 100; ++i) {
160 const int part = ... ;
162 promise.setProgressValue(i);
164 promise.addResult(result);
168QObject::connect(&watcher, &QFutureWatcher::progressValueChanged, [](
int progress){
170 qDebug() <<
"current progress:" << progress;
172watcher.setFuture(QtConcurrent::run(aFunction));
188void foo(
int arg1,
int arg2);
190QFuture<
void> future = QtConcurrent::run(foo, 42);
198QFuture<
void>
future = QtConcurrent::run(
static_cast<
void(*)(
int)>(foo), 42);
202QFuture<
void>
future = QtConcurrent::run(qOverload<
int>(foo), 42);
QFuture< void > future
[5]
void foo(int arg1, int arg2)
void aFunctionWithArguments(int arg1, double arg2, const QString &string)
[explicit-pool-0]
void aFunction(QPromise< void > &promise)
[8]
void aFunction(QPromise< void > &promise, int arg1, const QString &arg2)
[9]
QString someFunction(const QByteArray &input)
[2]
QString functionReturningAString()
[1]
void helloWorldFunction(QPromise< QString > &promise)
[10]
QFutureWatcher< int > watcher
void operator()(QPromise< int > &)