Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt6-changes.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page concurrent-changes-qt6.html
6
\title Changes to Qt Concurrent
7
\ingroup changes-qt-5-to-6
8
\brief Improved to work with a variable number of arguments.
9
10
Qt 6 is a result of the conscious effort to make the framework more
11
efficient and easy to use.
12
13
We try to maintain binary and source compatibility for all the public
14
APIs in each release. But some changes were inevitable in an effort to
15
make Qt a better framework.
16
17
In this topic we summarize those changes in Qt Concurrent, and provide
18
guidance to handle them.
19
20
\section1 QtConcurrent::run()
21
22
QtConcurrent::run() has been improved to work with a variable number
23
of arguments, so the signatures are changed to:
24
25
\code
26
// run
27
template <typename T>
28
QFuture<T> run(Function &&f, Args &&...args)
29
30
// run with a QThreadPool argument
31
template <typename T>
32
QFuture<T> run(QThreadPool *pool, Function &&f, Args &&...args)
33
\endcode
34
35
As a side effect, if \c f is a pointer to a member function, the first
36
argument of \c args should be the object for which that member is defined
37
(or a reference, or a pointer to it). So instead of writing:
38
39
\code
40
QImage image = ...;
41
QFuture<void> future = QtConcurrent::run(&image, &QImage::invertPixels, QImage::InvertRgba);
42
\endcode
43
44
You have to write:
45
46
\code
47
QFuture<void> future = QtConcurrent::run(&QImage::invertPixels, &image, QImage::InvertRgba);
48
\endcode
49
50
Another side effect is that \c QtConcurrent::run() will not work with
51
overloaded functions anymore. For example, the code below won't compile:
52
53
\include qtconcurrentrun.cpp run-with-overload-calls
54
55
Other methods of QtConcurrent have no behavioral changes and do not introduce
56
source compatibility breaks.
57
*/
qtbase
src
concurrent
doc
src
qt6-changes.qdoc
Generated on
for Qt by
1.14.0