Doc: Document the specific headers for the Qt Concurrent module

This commit makes the Image Scaling example use the optimized header
and updates documentation to include optimized header inclusion for
QtConcurrent functions.

Fixes: QTBUG-114663
Pick-to: 6.10 6.9 6.8
Change-Id: I50e4137ea3bc22bf88a3c9e4856043ba3d02f06e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Alexei Cazacov 2025-09-03 15:50:47 +03:00
parent e6ddf72279
commit eba48b0c21
5 changed files with 85 additions and 1 deletions

View File

@ -4,7 +4,7 @@
#define IMAGESCALING_H
#include <QtWidgets>
#include <QtConcurrent>
#include <QtConcurrentRun>
#include <QNetworkAccessManager>
#include <optional>

View File

@ -26,6 +26,20 @@
Note that the result types above are not QFuture objects, but real result
types (in this case, QStringList and QSet<QString>).
\section1 Optimize includes
If you include the \c <QtConcurrent> header, the entire Qt Concurrent
module with the entire Qt Core module will be included, which may increase
compilation times and binary sizes. To use the
\l {QtConcurrent::filter}{QtConcurrent::filter()},
\l {QtConcurrent::filtered}{QtConcurrent::filtered()}, and
\l {QtConcurrent::filteredReduced}{QtConcurrent::filteredReduced()}
functions, you can include a more specific header:
\code
#include <QtConcurrentFilter>
\endcode
\section1 Concurrent Filter
QtConcurrent::filtered() takes an input sequence and a filter function.

View File

@ -13,6 +13,38 @@
See the \l {Qt Concurrent} module documentation for an overview of available
functions, or see below for detailed information on each function.
\section1 Optimize includes
If you include the \c <QtConcurrent> header, the entire Qt Concurrent
module with the entire Qt Core module will be included, which may increase
compilation times and binary sizes. To use individual functions from the
QtConcurrent namespace, you can include more specific headers.
The table below lists the functions in the QtConcurrent namespace and
their corresponding headers:
\table
\header
\li Function
\li Header
\row
\li \l {QtConcurrent::run}{QtConcurrent::run()}
\li \c <QtConcurrentRun>
\row
\li \l {QtConcurrent::task}{QtConcurrent::task()}
\li \c <QtConcurrentTask>
\row
\li \l {QtConcurrent::filter}{QtConcurrent::filter()},
\l {QtConcurrent::filtered}{QtConcurrent::filtered()},
\l {QtConcurrent::filteredReduced}{QtConcurrent::filteredReduced()}
\li \c <QtConcurrentFilter>
\row
\li \l {QtConcurrent::map}{QtConcurrent::map()},
\l {QtConcurrent::mapped}{QtConcurrent::mapped()},
\l {QtConcurrent::mappedReduced}{QtConcurrent::mappedReduced()}
\li \c <QtConcurrentMap>
\endtable
\inheaderfile QtConcurrent
\ingroup thread
*/
@ -130,6 +162,20 @@
Note that the result types above are not QFuture objects, but real result
types (in this case, QList<QImage> and QImage).
\section1 Optimize includes
If you include the \c <QtConcurrent> header, the entire Qt Concurrent
module with the entire Qt Core module will be included, which may increase
compilation times and binary sizes. To use the
\l {QtConcurrent::map}{QtConcurrent::map()},
\l {QtConcurrent::mapped}{QtConcurrent::mapped()}, and
\l {QtConcurrent::mappedReduced}{QtConcurrent::mappedReduced()} functions,
you can include a more specific header:
\code
#include <QtConcurrentMap>
\endcode
\section1 Concurrent Map
QtConcurrent::mapped() takes an input sequence and a map function. This map

View File

@ -23,6 +23,18 @@
This function is a part of the Qt Concurrent framework.
\section1 Optimize includes
If you include the \c <QtConcurrent> header, the entire Qt Concurrent
module with the entire Qt Core module will be included, which may increase
compilation times and binary sizes. To use the
\l {QtConcurrent::run}{QtConcurrent::run()} function, you can include a
more specific header:
\code
#include <QtConcurrentRun>
\endcode
\section1 Concurrent Run (basic mode)
The function passed to QtConcurrent::run() may report the result

View File

@ -18,6 +18,18 @@
This function is a part of the \l {Qt Concurrent} framework.
\section1 Optimize includes
If you include the \c <QtConcurrent> header, the entire Qt Concurrent
module with the entire Qt Core module will be included, which may increase
compilation times and binary sizes. To use the
\l {QtConcurrent::task}{QtConcurrent::task()} function, you can include a
more specific header:
\code
#include <QtConcurrentTask>
\endcode
\section1 Fluent interface
The QtConcurrent::task returns an instance of an auxiliary class called