summaryrefslogtreecommitdiffstats
path: root/src/concurrent
Commit message (Collapse)AuthorAgeFilesLines
* Fix QThreadPool::maxThreadCount() usageIvan Solovev2024-01-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The docs claim that QThreadPool always creates at least one thread. However, the user can (usually by mistake) request zero or a negative number of threads. The maxThreadCount() function is simply returning the value, that was requested by the user. Since it's a public API, it is used in several places in QtConcurrent, where it is assumed that the value is always positive. This can lead to a crash if the user sets zero as a maxThreadCount. Update all such places with std::max(maxThreadCount(), 1). Prefer this approach over changing the return value of maxThreadCount(), because its behavior is documented and tested. Amends 885eff053797d56f2e295558d0a71b030fbb1a69. Fixes: QTBUG-120335 Pick-to: 6.5 6.2 Change-Id: Id3b2087cec7fbc7a2d42febca6586f2dacffe444 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 936e72d18075b79c8d29353618dfbd052ae59dae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 41a605e0f2251db78cb852bb161dd0020c63c935)
* [docs] Link from QtConcurent::run() to QThreadPool::start(Callable&&)Marc Mutz2023-08-051-1/+5
| | | | | | | | | | | | | | | | The latter is a better choice if you don't need the result QFuture. Describe the QThreadPool::start() overload in prose, since the signature changed in 6.6 from std::function<void()> to Callable auto&&. The chosen wording is compatible with both. Fixes: QTBUG-111875 Change-Id: I9f67c2f7e4b221602bf1c35b72e5d38898a4f0c9 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 47a0282707d6a0d12f6f584c81a982632d09cfb7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFuture: mention the work-stealing algorithm in the docsDennis Oberst2023-06-261-3/+2
| | | | | | | | | | | | | | | | | | | A number of users have explored the behavior and complained about it. Lets add a \note explaining this. The function in charge is QThreadPool::stealAndRunRunnable(QRunnable *), which is a private function, exclusively used by: QFutureInterfaceBase::waitForResult() QFutureInterfaceBase::waitForFinished() also update the documentation to reflect these changes accordingly. Fixes: QTBUG-112351 Change-Id: I839858cb449063d8af9bef64d2f35a6816a419b0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 0235de994be7e04aca3456f1260b18313dd45b74) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Clarify module changes in Qt6Jaishree Vyas2023-05-091-1/+1
| | | | | | | | | Changed Briefs for better understanding Fixes: QTBUG-109324 Pick-to: 6.5 Change-Id: I15b0c0dc12b1bf96626fb8ea4ad16d04b2b118ca Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Rework imagescaling example to avoid potential crashesIvan Solovev2023-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Creating a continuation with QtFuture::Launch::Async policy does not work well with the example, because it still needs to update the UI once the async continuation is finished. If the user decides to close the application while the async continuation is executed, the next continuation will be accessing data from the destroyed Images object. Fix it by using QtConcurrent::run() to do the "heavy" work in a separate thread, and use a QFutureWatcher to handle the results of the async execution. Update the example documentation accordingly. After this patch the example still shows the usage of continuations and onCanceled()/onFailed() handlers. However, it now does not illustrate the usage of different launch policies and continuation contexts. It might not be a big issue, because the QFuture documentation describes these topics rather extensively. Fixes: QTBUG-103514 Pick-to: 6.5 Change-Id: I8142535064ff7a4e8007a5c0a8fe7709d6d942ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QtConcurrent: fix warning due to assignment to narrower integer typeHamish Moffatt2023-04-031-3/+3
| | | | | | | | | | MSVC warns due to assignment of std::distance's return value (__int64) to int when warning C4244 is enabled. Pick-to: 6.5 Change-Id: I78360ec1bbe861b96d6875af3a29b77f419a3843 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtConcurrent: yield CPU when spinning on atomicsMårten Nordheim2023-02-281-0/+6
| | | | | | Pick-to: 6.5 Change-Id: I3eef19d8737da60bee40385a64a1bc136d2e7329 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QtConcurrent Examples pageIvan Solovev2023-02-243-1/+24
| | | | | | | | | | | | | The QtConcurrent examples were only discoverable from the "All Qt Examples" page, which was very inconvenient. This patch adds a separate page for all Qt Concurrent examples, and links to it from the module's main page. Pick-to: 6.5 Change-Id: Iecabd9e21033605c1ec74232ce4f3d68b0c78d82 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* src: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-101-3/+0
| | | | | | Pick-to: 6.5 Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-2114-49/+49
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-232-2/+2
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-032-0/+6
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add \brief descriptions to QtConcurrent topicsSona Kurazyan2022-07-204-0/+4
| | | | | | | Fixes: QTBUG-104213 Pick-to: 6.4 6.3 6.2 Change-Id: Ib787546ef74133aca4b963a4341283147d2e8fb2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtConcurrent::ReduceKernel: fix race conditionsSona Kurazyan2022-07-201-0/+2
| | | | | | | | | | | | | resultsMapSize is modified inside the runReduce() method, and the writes are protected via mutex lock. However, reads of resultsMapSize through shouldThrottle()/shouldStartThread() (that can be called by multiple threads) are done without a lock. Added the missing locks. Task-number: QTBUG-104787 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I700e7b66e67025bc7f570bc8ad69409b82675049 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add the qt_class pragma to file listed in sync.profile classnames mapAlexey Edelev2022-06-223-0/+12
| | | | | | | | | This makes header files self-contained and reduces the number of 'sources of truth' for syncqt procedure. Change-Id: I7f5865abc69934603139d23e1b5452da46ccb110 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtConcurrent: prevent conversion of ReduceOption to initial valueSona Kurazyan2022-05-204-41/+81
| | | | | | | | | | | | | | | | | | | | | | | | QtConcurrent map- and filter-reduce functions take an initial value, which can be of any type that is convertable to the result type. The side-effect of this is that the enum values passed as ReduceOptions can be treated as an initial value (if they are convertable to the result type) which will result into a wrong overload call. To avoid this, added additional check to make sure that the initial value type doesn't match with ReduceOption enum. Note that this required including the qtconcurrentreducekernel.h header in qtconcurrentfunctionwrappers.h (which contains compiler checks for QtConcurrent) for accessing ReduceOption enum, so I had to get rid of qtconcurrentfunctionwrappers.h include from qtconcurrentreducekernel.h to avoid circular header includes. This, in turn, required moving the QtPrivate::SequenceHolder helper type to qtconcurrentreducekernel.h, which didn't belong to qtconcurrentfunctionwrappers.h anyway. Pick-to: 6.3 6.2 Fixes: QTBUG-102999 Change-Id: Ieaa8ef2e4bd82ce2ada2e0af9a47b87b51d59e87 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1630-1124/+60
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Do not highlight the Image Scaling Example anymore in Qt CreatorKai Köhne2022-02-171-2/+0
| | | | | | | | Pick-to: 6.3 Fixes: QTBUG-100645 Change-Id: I9f2e2c022a00a024917327028b403d36ca2a4b48 Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Remove mentions of QtConcurrent::runWithPromise from docsSona Kurazyan2022-02-112-15/+8
| | | | | | | | | | | | cf043a785ac9357e8f1283ea9e1496261af2b1a5 unified QtConcurrent::run() and QtConcurrent::runWithPromise(). Remove the last mentions of runWithPromise. Also did some minor cosmetic improvements. Pick-to: 6.3 Change-Id: Ie3b39600978ccfa4a009d3ff68567a348dc7b166 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Fix memory leak in QtConcurrent::run when called with a NULL QThreadPoolSona Kurazyan2022-01-241-0/+1
| | | | | | | | | | QThreadPool automatically deletes the runnable after it finishes running the task. In case QThreadPool is nullptr, we should delete the runnable manually. This amends 87b93c29be02f0a7ff9424b5e2b6431e20bd4c40. Pick-to: 6.3 6.2 5.15 Change-Id: Id7e4ed3d4d6de05990edf62e4099852983debc64 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent: use variable templates for compile-time checksSona Kurazyan2022-01-203-17/+10
| | | | | | | | | Noticed during the API review. Pick-to: 6.3 6.2 Task-number: QTBUG-99883 Change-Id: I19571343a0cf0609beae2422ef1f69f7a34eb9ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtConcurrent::run crashes on program exitTianlu Shao2021-12-201-1/+7
| | | | | | | | | | | | When an application is about to be closed and all the destructors are called, if there isQtConcurrent::run on the way, it crashes as the internal threadpool pointer is nullptr. Fixes: QTBUG-98901 Pick-to: 6.2 6.3 Change-Id: Idd84d1518fc6a225263e6666a0f1de2ccef79c82 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-091-1/+1
| | | | | | | | | | Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Pick-to: 6.2 Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Doc: Enable qdoc warning count limitVenugopal Shivashankar2021-10-211-0/+3
| | | | | | | | This should restrict changes that introduce new warnings. Change-Id: I7e4b5d9d5d84b7c336509c380bc7e6d86e360f4a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* concurrent: Fix typo in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ibe3715de704f420ba3796d19c9e78cd6204eb4e5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* concurrent: Fix namespace typoJonas Kvinge2021-10-121-1/+1
| | | | | Change-Id: I7fed1f3965f97a4e1c4d096bc19f98572ea35c53 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove checks for features available in C++17Ievgenii Meshcheriakov2021-10-021-2/+0
| | | | | | | | | | This patch removes most of the checks that are made using C++20 __cpp_* macros for features available in C++17 and earlier. Library feature check macros (__cpp_lib_*) are unaffected. Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QtConcurrent::blockingMapped to work with non-template sequencesSona Kurazyan2021-09-081-1/+7
| | | | | | | | | | | | | | | The code for deducing the type of output sequence was assuming that the input sequence is always a template class and was trying to use the corresponding container type for the output sequence. Fixed the deduction code, to assume that the output sequence has the same type as the input sequence, when it's not a template class. Also added tests to verify that all QtConcurrent functions support non-template input sequences. Fixes: QTBUG-30617 Pick-to: 6.2 6.1 Change-Id: I486fe99f3207cfff5dcceb3712cc7de863067edb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove unsupported customFiltersKai Köhne2021-09-031-4/+0
| | | | | | | | | | | customFilters defined in .qdocconf are not supported anymore by Qt Assistant since Qt 5.13. Therefore remove them from all .qdocconf files, also to avoid cargo-culting them to new help modules. Task-number: QTBUG-95987 Change-Id: I664391460637d2e859348da0338e1a4a3ee9f570 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtConcurrent: fix examples of overloaded methods in docsSona Kurazyan2021-08-184-8/+18
| | | | | | | | | | | | Wrap the overloaded methods in qOverload(), to make the examples compile. Also remove the extra whitespaces when declaring nested templates. Pick-to: 6.1 6.2 Change-Id: If438caa6d705d9036dae45278fb26e080918da89 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent::run: support non default-constructible return typesSona Kurazyan2021-08-182-26/+11
| | | | | | | | | | | | | | The QtConcurrent::RunFunctionTask class keeps a variable to store the result of QtConcurrent::run when it becomes available, so that it can be reported afterwards. This requires the result type to be default-constructible. However there's no need in storing the result, it can be reported immediately after it becomes available. Pick-to: 6.1 6.2 Fixes: QTBUG-95214 Change-Id: I95f3dbff0ab41eaa81b104a8834b37d10a0d193a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Update QtConcurrent docs and examples for reductor object usageSona Kurazyan2021-07-264-23/+11
| | | | | | | | | After 6ebe3d0f0806069f906522dfe9b81baa3f3478de users don't have to specify the result type when using functors for as a reductor. Task-number: QTBUG-88448 Change-Id: I065fed11c1a66833ba0aac3d18e7ff0545247be1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent: Remove the redundant code for QStringListSona Kurazyan2021-07-262-8/+0
| | | | | | | | | QStringList is a typedef for QList<QString>, so it doesn't need special handling. Change-Id: Ib371f9fa49d9d45da7956287dd0f5b6c0224f439 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix QtConcurrent to properly work with functorsSona Kurazyan2021-07-213-71/+101
| | | | | | | | | | | | | | | QtConcurrent reduce functions were requiring to explicitly pass the the result type when passing functors as reductor. This was because of inability to deduce the result type from the functors. The result type of the QtConcurrent reduce functions should match with the type of the fist argument of the operator() when a functor is passed. Reused the ArgResolver type trait (already used for QFuture and QtConcurrent::run) to find out the result type in that case. Task-number: QTBUG-88448 Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-06-252-14/+2
| | | | | | | | | Replace the hardcoded cpp exports with a generated one where it's applicable. Task-number: QTBUG-90492 Change-Id: Idc160b594987b2c765e75bd669aae851b4366282 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the dead code for blocking methods from QtConcurrentSona Kurazyan2021-06-142-56/+0
| | | | | | | | | | | | | | After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running QtConcurrent algorithms in the blocking mode aren't used anymore. Since ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used externally, it should be fine to remove startBlocking() methods now. Removed the unused code and adjusted the tests accordingly. Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QtConcurrentIterateKernel: fix warningMårten Nordheim2021-04-121-1/+1
| | | | | | | | | src\concurrent\qtconcurrentiteratekernel.cpp(134): warning C5055: operator '*': deprecated between enumerations and floating-point types Pick-to: 6.0 6.1 Change-Id: I934e767e77e9393e1da3adc390dc8e252e7f5b6a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Remove the unnecessary template parameter from the class specializationSona Kurazyan2021-03-171-2/+2
| | | | | | | | | | | | This seems to cause errors when compiling with gcc-11. Although this is most likely a compiler bug, specifiying the template parameter type in this case isn't necessary. Fixes: QTBUG-91909 Fixes: QTBUG-90568 Pick-to: 6.0 6.1 5.15 Change-Id: Ib231257ccb2e16cc533f23ca5840d31e26a66d53 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Improve docs for Qt Concurrent run with promise modeSona Kurazyan2021-03-041-0/+9
| | | | | | | | | | | | For the readers that are new to QtConcurrent, it may be confusing that unlike the normal usage of QPromise, they don't have to call start() or finish() when using Qt Concurrent run with promise mode. Be more explicit about that. Pick-to: 6.1 Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Revert "Remove the qmake project files" for snippetsNico Vertriest2021-02-121-0/+3
| | | | | | | | | | | This reverts a limited part of commit ad2da2d27a590333fc89a56fc58700a09c3017b3 that deleted .pro files for snippets compilation. Some .pro files which contain snippets used in the documentation itself should be restored. Task-number: QTBUG-90483 Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-072-44/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Document that QtConcurrent::run doesn't support overloaded functionsSona Kurazyan2020-12-233-0/+43
| | | | | | | | | | | | 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 Pick-to: 6.0 Change-Id: I4c1f996ae67bce8c13cc1f99f54240295db6ae1d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Clean up qtconcurrent.qdocconf fileKai Koehne2020-12-101-2/+1
| | | | | | | | Remove unused parent directory for exampledirs. Also fix content of excludedirs. Change-Id: Iac15ec3eb12121c0384e36c31299034624257db4 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtConcurrent: filter/map reduction without default ctorIvan Solovev2020-12-043-34/+99
| | | | | | | | | | | | | | | | | Previously a default constructor was required for the result type of mappedReduced() and filteredReduced(), even if a default value was provided. This patch fixes the problem. The issue was in the ResultReporter type, that was calling QList::resize() to adjust the size of expected reported results. A default-value parameter was added to the class, so that a corresponding overload of QList::resize could be invoked. Task-number: QTBUG-88452 Change-Id: I51113753e314d76aa74d201b5a7e327a6ca75f47 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-11-301-1/+1
| | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Pick-to: 6.0 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update landing pages and module pages in qtbaseJerome Pasion2020-11-172-28/+29
| | | | | | | | | | -Qt SQL, Qt D-BUS, Qt GUI, Qt OpenGL, Qt Widgets, Qt Test, Qt Concurrent, Qt XML, Qt Network, Qt Core -language edits for consistency, add links Task-number: QTBUG-87155 Change-Id: Ic61350c9fa15090c802a42d8e9116219591eba73 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Don't highlight the QtConcurrent progress dialog exampleSona Kurazyan2020-11-121-2/+1
| | | | | Change-Id: Iaccfc5b8d30f6903c5d27b5ed379d1ca364f7c69 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Improve QtConcurrent ImageScaling example to demo new featuresSona Kurazyan2020-11-121-1/+2
| | | | | | | | | | | | | In order to demonstrate the new functionality, changed the example to download the images from the network, scale and show them by attaching different continuations to QFuture. Because QtConcurrent::map is not used anymore, removed the suspension functionality (supporting suspension of download would complicate the logic). Task-number: QTBUG-87205 Change-Id: I5a48b63195d28025ae8c5de28bc6d6178dad03db Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Reorder IterateKernel data members to avoid holes in the dataSona Kurazyan2020-11-091-6/+7
| | | | | Change-Id: I7661eaa6b14b7a7b930390e6bb8c6894f4a91846 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>