summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Implement QTest::qWait() in terms of QTest::qWaitFor()Edward Welbourne2021-12-091-18/+2
| | | | | | | | A comment in the existing implementation encouraged doing so, but for a bug in GCC 6. We no longer care. Change-Id: Ia8cb2bc5e184510e3d756e8bbfe6bc0e852e6830 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Mark the new deployment API as being in Technical PreviewAlexandru Croitor2021-12-098-0/+30
| | | | | | | | Amends 22c92f39670d0376478cc2e73a17307508f86692 Task-number: QTBUG-98545 Change-Id: Ifaa7e4884f0eb1caa6d3d4906a2701f8fa5e43c2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix some of the CMake commands not using the right doc groupAlexandru Croitor2021-12-092-2/+2
| | | | | | | | Augments e0ecb0ded21082f4e00ee77411339009cb1294a4 Pick-to: 6.2 Change-Id: I4eea51b66ffa5ffe45faa3c51a4b65a526dd73e7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QVarLengthArray: make reallocation strongly exception safeMarc Mutz2021-12-092-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code had several bugs: - it immediately clobbered *this with new state, before having copied over the elements from the old to the new buffer - when buffer relocation threw, it would keep the new (partially-filled) buffer and throw away the old - it unconditionally used std::move() for non-relocatable types, making it impossible to restore the original buffer when a move throws Instead of clobbering *this with new state, do all the work on the side and change *this only once the reallocation has happened successfully. Also use q_uninitialized_relocate_n() and unique_ptr in the implementation to simplify the code. The former got the necessary update to use std::move_if_noexcept() instead of an unconditional std::move() for the non-relocatable case. [ChangeLog][QtCore][QVarLengthArray] The append()-like functions are now strongly exception safe. This means reallocation will now use copies instead of moves, unless the value_type has a noexcept move constructor. Fixes: QTBUG-99039 Change-Id: I031251b8d14ac045592d01caed59d4638c3d9892 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: implement append() via emplace_back()Marc Mutz2021-12-091-12/+5
| | | | | | | | Less code duplication, means less functions to move into the upcoming QVLABase. Change-Id: I67a817c971a4e5a81ae45ff30282878be1bde2aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: inline some trivial reallocate() wrappersMarc Mutz2021-12-091-15/+3
| | | | | | | | | | | These functions don't deserve to be defined outside the class body, as they're trivial wrappers around reallocate(). Cleans up the header somewhat, in preparation of the upcoming QVLABase/QVLAStorage split. Change-Id: Ib4062eca4214a67e67f472a7c1e4bf4d9813c8a4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: use C++14 4-arg std::equal()Marc Mutz2021-12-091-6/+1
| | | | | | | | | Simplifies the code, since we now need neither the manual size check, nor the warning fix (checked iterator macro) for MSVC. Change-Id: Ic267c66eb4568d2db8d9c9ccad0ce7e1a5cc3373 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Re-enable parsing Qt code with LLVM (Qt for Python)Friedemann Kleint2021-12-091-1/+1
| | | | | | | | | | Exclude the check introduced by 0dc6cc055174a0556f2e41ca269013b3a7056c86 for clang compilers since there seems to be no equivalent option -permissive- for the MSVC emulation. Change-Id: I0468d8e2f2c988e604be6960f1b1f4760ea0c400 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QLocale: Extend support for language codesIevgenii Meshcheriakov2021-12-096-357/+533
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extends functionality for QLocale::codeToLanguage() and QLocale::languageToCode() by adding an additional argument that allows selection of the ISO 639 code-set to consider for those operations. The following ISO 639 codes are supported: * Part 1 * Part 2 bibliographic * Part 2 terminological * Part 3 As a result of this change the codeToLanguage() overload without the additional argument now returns a Language value if it matches any know code. Previously a valid language was returned only if the function argument matched the first code defined for that language from the above list. [ChangeLog][QtCore][QLocale] Added overloads for codeToLanguage() and languageToCode() that support specifying which ISO 639 codes to consider. Fixes: QTBUG-98129 Change-Id: I4da8a89e2e68a673cf63a621359cded609873fa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fall back to include() method for finalizers with CMake 3.17 or earlierCraig Scott2021-12-081-5/+9
| | | | | | | | | | | | | | | | Functionality is being added in other repos which require finalizers to be run for non-static builds. That means we now need to ensure finalizers always run even with CMake versions before cmake_language() was added. The fallback method of writing to a file and including it is slower, but that's better than missing important functionality altogether. Task-number: QTBUG-98545 Pick-to: 6.2 Change-Id: Ic8668c91c26d0c30de084b1b803032088c10fcf4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add documentation for CMake deployment supportCraig Scott2021-12-0810-5/+717
| | | | | | Task-number: QTBUG-98545 Change-Id: Ifd5c0f4ce278c683bb0d3ba6a259ec14a7f24181 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add CMake deployment supportCraig Scott2021-12-084-0/+561
| | | | | | | Task-number: QTBUG-98545 Change-Id: I581c1173cdfc92c09fd2cf0bbe7ec6bc8d52b868 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QVarLengthArray: fix size update on failed append()Marc Mutz2021-12-081-6/+5
| | | | | | | | | | | | | If the in-place constructor throws, the old code had already updated the container's size(). Fix by delaying the update to after the in-place construction. [ChangeLog][QtCore][QVarLengthArray] Fixed a bug whereby a failed append() would leave the container with an inconsistent size(). Pick-to: 6.2 5.15 Change-Id: Ief1e668d945149bd8ba96c8af1398baaa7876880 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCoffParser: Replace windows.h with qt_windows.hYuhang Zhao2021-12-091-4/+1
| | | | | Change-Id: I9aeeb2cef4d068020e0c176a70ad86c9e28b0e68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Compile: Work around false positive on gcc >= 900"Joerg Bornemann2021-12-081-1/+1
| | | | | | | | | | This reverts commit d62e9d3c5bd9d3aae5f4b72ed0688dcbd02134a7. Reason for revert: The -Wstringop-overread option was introduced in gcc 11. This fixes the build for gcc 9 and 10. Change-Id: I96ab5f917d6200cb1681fe6236f1fd4630ef4f7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement fetching physical QStorageInfo::blockSize() under WindowsKarsten Heimrich2021-12-084-1/+240
| | | | | | | | | | | | | | | | | | This is implemented in two passes, first we try the older and always available DeviceIoControl() function. This works most of the time, though it might fail for example for storage devices attached via USB. In this case, we try to dynamically load the newer NtQueryVolumeInformationFile kernel function. Since this is probably more expensive, we do this as fallback. [ChangeLog][QtCore][QStorageInfo] The QStorageInfo::blockSize() will now report the physical block size of a storage device under Windows. Network mapped drives are not supported. Fixes: QTBUG-93976 Change-Id: I08b5b879e5bf79c025e2e305196ec5c5fce8b20f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Doc: Reword, fix typos and some formattingIvan Tkachenko2021-12-082-7/+8
| | | | | Change-Id: I0929f7653cb07665842d0aa7bf18dc80471febdc Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QVarLengthArray: remove unneeded copy in replace()Marc Mutz2021-12-071-3/+2
| | | | | | | | | | | | | | | QVarLengthArray is neither implicitly shared, nor does it feature a magic resize() on out-of-bounds. Therefore, data() doesn't detach(), so 't' remains stable. The only reason for the copy, then, would be if T wasn't self-assignment-safe, but we don't support such types. Remove the copy. Change-Id: I8dd12e1c9b8131ae17d641354fe362554062b78d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: don't mix iterator/const_iterator in offset calcMarc Mutz2021-12-071-4/+4
| | | | | | | | | | | | The functions aren't const so begin() will return a mutable iterator. The function arguments, however, are const_iterators. It doesn't matter for QVLA, which isn't implicitly shared, but code hygiene suggests to use cbegin() instead, to compare const_iterators to const_iterators. Change-Id: I9bfa993780ee4b68d13f6b6410772b0f1ccedad3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVarLengthArray: port internal users from at() to op[]Marc Mutz2021-12-071-2/+2
| | | | | | | | | In preparation of splitting the class into QVLABase and QVLAStorage. Task-number: QTBUG-84785 Change-Id: Ic0da6c2e110a5b979b78989616b9a2cb0f27463b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QThread::create(): request interruption and join on destructionGiuseppe D'Angelo2021-12-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one destroys a running QThread, so far the behavior has been to crash (à la std::thread) -- assuming the thread hasn't already signalled that it has finished. This behavior is hostile to solutions such as using QThread::create(), which always require a wait() before destroying the thread object. We can use the opportunity to change the behavior without breaking any valid code. Instead of crashing, inside QThread's destructor we can ask the new thread to quit, and then join it (à la std::jthread). This simplifies the implementation of long-living runnables and the code that manages them. Deploying this solution for the whole QThread class may not be entirely painless. While no correct code would work differently with the proposed changes, incorrect code that deletes a running thread would no longer crash "loudly" -- instead, it might deadlock "quietly", have memory corruptions, etc. Hence I'm limiting this approach to only the threads created by QThread::create(), at least for the time being. This also side-steps perhaps the biggest problem of generalizing the approach, which is that placing such interrupt+join logic into~QThread's destructor would cause it to be run _after_ a QThread subclass' own destructor has run, destroying the subclass' data members too early. This might create an antipattern if one chooses to subclass QThread. With create(), a subclass in question exists, and it indeed has NSDMs, but it's entirely under our control (in fact, I'm placing the logic just in its dtor). [ChangeLog][QtCore][QThread] Destroying a QThread object created by QThread::create() while the thread that it manages is still running will now automatically ask that thread to quit, and will wait until the thread has finished. Before, this resulted in a program crash. See the documentation of QThread::~QThread() for more details. Change-Id: Ib268b13da422e277ee3ed6f6c7b2ecc8cea5750c Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QVarLengthArray: merge remove(idx [,n]) into one functionMarc Mutz2021-12-072-16/+1
| | | | | | | | remove(i) is the same as remove(i, 1), and the extra 'n' argument is of trivial type, so it's ok to default it instead of overloading. Change-Id: Id926cd63fde518e002684a41e055edc1004247a4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLogging: mark all warning() and critical() functions as coldMarc Mutz2021-12-071-0/+6
| | | | | | | | | Previously, only the printf-style overloads were marked as such. Saves ~7KB in QtCore text size on Linux AMD64 GCC 11 C++ 20 builds. Change-Id: I4ed480e48060b87968f3d15bb5a84bdbcf70a647 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: centralize index checkingMarc Mutz2021-12-071-13/+22
| | | | | | | | | Factor the assertions relating to sizes and indexes into an inline function, verify(). This hopefully reduces the string data generated for assertions to the bare minimum. Change-Id: Iad5c2e587ad189e7e1a62b9ca61ada4282c44f51 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMultiHash: fix erase returning the wrong iteratorMårten Nordheim2021-12-071-2/+3
| | | | | | | | | | | | When deleting the last item in a chain, without it being the last item in the chain, then we re-use the iterator which was passed in as an argument. This is wrong if we detached earlier in the function, and means we return an iterator to the previously shared data. Pick-to: 6.2 Change-Id: I7da6309e23a32073da59e7da0cbfd1d16734f1ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Optimize QMimeDatabase::mimeTypeForFile(f, MatchDefault)Igor Kushnir2021-12-061-52/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Open the file only if matching on content is needed. Use QFileInfo::filePath() instead of QFileInfo::absoluteFilePath() in QMimeDatabase::mimeTypeForFile(). filePath() does much less work, and so is faster. Thiago Macieira helpfully explained in a review comment why the absolute path is not useful for correctness here: "Nothing needs absolute paths within the same application that would resolve the relative path to absolute. You only need an absolute path if you're communicating with another application that may be in a different directory." QMimeDatabase::mimeTypeForFile() checks fileInfo.isDir(), so the fileName.endsWith(QLatin1Char('/')) check in QMimeDatabasePrivate::mimeTypeForFileNameAndData() was redundant when called from this function. The other two callers of that function now check this condition before opening IO devices. This improves performance of the two QMimeDatabase::mimeTypeForFileNameAndData() overloads in the corner case. Refactor and optimize QMimeDatabasePrivate::findByFileName() and its usages. Previously each caller constructed a QFileInfo object and passed QFileInfo::fileName() into this function. Now the callers simply pass an absolute or relative path to a file into this function, which then uses QFileSystemEntry::fileName() to exclude the path. Constructing QFileInfo is relatively expensive, so this change slightly improves performance. Optimize QMimeDatabasePrivate::loadProviders() by calling static QFileInfo::exists() instead of constructing a QFileInfo object and calling the non-static QFileInfo::exists() overload. Note that the QFileInfo object was always created, even if QFileInfo::exists() under an `if` and an `#if` was never called. The following table contains the average results of the added benchmark tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before and at this commit. The numbers denote milliseconds per iteration. data row tag before at MatchDefault: archive 0.029 0.016 OpenDocument Text 0.029 0.015 existent archive with extension 0.039 0.025 existent C with extension 0.033 0.020 existent text file with extension 0.033 0.020 existent C w/o extension 0.076 0.074 existent patch w/o extension 0.11 0.105 existent archive w/o extension 0.069 0.066 MatchExtension: archive 0.012 0.0115 OpenDocument Text 0.0115 0.011 existent archive with extension 0.017 0.016 existent C with extension 0.011 0.011 existent text file with extension 0.011 0.011 existent C w/o extension 0.016 0.0155 existent patch w/o extension 0.013 0.012 existent archive w/o extension 0.013 0.012 MatchContent: archive 0.019 0.012 OpenDocument Text 0.019 0.012 existent archive with extension 0.053 0.051 existent C with extension 0.056 0.0545 existent text file with extension 0.058 0.056 existent C w/o extension 0.0605 0.059 existent patch w/o extension 0.10 0.099 existent archive w/o extension 0.057 0.054 Change-Id: Idb541656e073a2c4822ace3f4da412f29f2351f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Add a const overload for QMetaType::iface()Ulf Hermann2021-12-061-0/+4
| | | | | | | Change-Id: I865dc51d466d90636e177556d95558ba66f466de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_qfloat16 runtime failure for INTEGRITYTatiana Borisova2021-12-061-1/+1
| | | | | | | | | | - GHS compiler is not fully compliant with iec559. Therefore we need to update is_iec559 checking for GHS case. Pick-to: 6.2 Change-Id: Ia094509d26bf5f0109f2937547a056267019cffb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
* QMetaType: port the BC fix for id() to new QT_REMOVED_SINCEMarc Mutz2021-12-064-16/+19
| | | | | | | The allows qmetatype.cpp compilation to enjoy PCH again. Change-Id: I47c5af33a5dbc930ee4c120b254e732c52bc2369 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qBound: add an assert on !(upper < lower)Giuseppe D'Angelo2021-12-061-53/+67
| | | | | | | | | | | | | | It's a precondition and we might just as well check it, given that people have actually got the order of the arguments wrong (cf. QTBUG-69330). Unfortunately, Q_ASSERT is defined below qBound in qglobal.h, so I had to reshuffle some code around. Change-Id: I82e52bcb863ff8c96594817e0cd5d7d2abe2e57e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStringBuilder: Add support for QByteArrayViewMårten Nordheim2021-12-041-0/+21
| | | | | | | [ChangeLog][QtCore][QStringBuilder] Added support for QByteArrayView. Change-Id: If2c23549d533dd31c320f3ee455fcd01ea5b460a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFile: Add open() overload that accepts permissions argumentIevgenii Meshcheriakov2021-12-042-1/+49
| | | | | | | | | | | | | | | The new overload allows creation of files with non-default permissions. This is useful when files need to be created with more restrictive permissions than the default ones, and removes the time window when such files are available with less restrictive permissions. [ChangeLog][QtCore][QFile] Added QDir::open() overload that accepts permissions argument. Fixes: QTBUG-79750 Change-Id: Iddfced3c324e03f2c53f421c9b31c76dee82df58 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractFileEngine: Add permission argument to open()Ievgenii Meshcheriakov2021-12-0410-16/+51
| | | | | | | | | The new argument allows atomic creation of files with non-default permissions. Task-number: QTBUG-79750 Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Repair parameter typeChunLin Wang2021-12-033-3/+3
| | | | | | | | | Fix the parameter types corresponding to the sample code and subclasses Fixes: QTBUG-98578 Pick-to: 6.2 Change-Id: I06e342ae1210ed53c5deec3e2711457cf2ac5b15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6Marc Mutz2021-12-031-8/+0
| | | | | | | There are no users left in the tree. Change-Id: I336f4e15c0ec1f5933c1fcfa661bad85bd38ed35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reduce scope of a hack using volatile in favor of viewAt()Edward Welbourne2021-12-021-11/+7
| | | | | | | | | | | We can now get qt_configure_strs to tell us the size of the string, as well as its start, bypassing the strlen()-calling branch of fromLocal8Bit() that caused the need for a hack using a volatile variable. However, QT_CONFIGURE_SETTINGS_PATH still needs the volatile hack. Change-Id: I0181abf512123e6355acdd506d6845c3fb75c0e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString et al: fix lastIndexOf() API asymmetryMarc Mutz2021-12-024-4/+25
| | | | | | | | | | | | | | | | | Commit 6cee204d56205e250b0675c9c6d4dd8a2367f3c4 introduced overloads of lastIndexOf() which drop the 'from' argument, inadvertently fixing QTBUG-80694, but failed to provide the new overloads for all existing lastIndexOf() overloads, making the fix for QTBUG-80694 incomplete. This patch completes the fix, by adding the missing overloads (for char-likes) and also adds the missing (non-regex) tests to tst_qstringapisymmetry. Also amends 1c164ec7f21a78025475c561a70b94d1e3dd6bb6. Fixes: QTBUG-80694 Change-Id: Ib4b3d597d658ce2edf01a2bce0d711ecea593d6e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix dependency chain that collects the metatype json filesAlexey Edelev2021-12-021-1/+8
| | | | | | | | | | | | | | | | | | | | | cmake_automoc_parser has the logic preventing the run of moc with the --collect-json parameter if metatype json files are not changed. This logic only verify if the file list is changed but not their content. This change adds a timestamp file that contains the last metatype json file timestamp that was modified during the last cmake_automoc_parser run. The logic still prevents of running 'moc --collect-json' when the list of metatype json files is not changed, but also checks if their content is no changed. Another approach it to generate the depfile that can be utilized by CMake in add_custom_command as DEPFILE argument. But this concept only works from the second build attempt because of an issue related to dyndep. Pick-to: 6.2 Fixes: QTBUG-98532 Change-Id: I713f8bfa9ae769cefe0beac0b7fa19750b00a765 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace BUILD_OPTIONS_LIST variable by the getter functionAlexey Edelev2021-12-021-54/+70
| | | | | | | | | Encapsulate configuration options in a function and use it instead of a globally defined variable. Pick-to: 6.2 Change-Id: I5c69c207788fe069fdd046b68a6bc58aa16e71b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use depfile to control ABI-specific builds of executable targetsAlexey Edelev2021-12-021-14/+44
| | | | | | | | | | | | | qt_internal_${target}_copy_apk_dependencies should use CMake DEPFILE approach when it's possible. Since we don't have any specific artifact that androiddeployqt can produce when collecting dependencies this change adds simple timestamp file that is touched each time when androiddeployqt is running. The timestamp is used then as a file-level dependency for the qt_internal_${target}_copy_apk_dependencies target. Task-number: QTBUG-88841 Change-Id: I985535c7b6e471cb4cfbf90128628087dadc72d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the external projects approach for multi-abi buildsAlexey Edelev2021-12-022-33/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of generating external projects that build the project tree for each target, this creates a single project for each ABI that have the common for all targets configure steps. Each executable target then adds additional build step to each ABI-specific external project, that builds and copies dependencies to the "main" project build tree. To resolve dependencies from the build tree, when building multi-abi apk instead of scanning the build directories of external projects for dependencies, it makes sense to run androiddeployqt for each ABI-specific external project to copy all necessary libraries. This is done by adding --copy-dependencies-only flag to androiddeployqt that only copies the apk dependencies, but avoids creating apk and all the essential steps. The ABI-specific external project now handles the deploying of the build artifacts to the end-point apk deployment directory and the "main" project assembles the apk using collected artifacts. The ABI-specific external project uses the qt_internal_${target}_copy_apk_dependencies target to run androiddeployqt with the introduced --copy-dependencies-only flag. TODO: Build steps that build and copy the ABI-specific apk dependencies are non-skipable and will run each time top-level build is triggered. This behavior should be fixed by adding dependencies to the generated by androiddeployqt DEPFILES for each ABI in the top-level build. Task-number: QTBUG-88841 Tash-number: QTBUG-94714 Change-Id: Id442a9fbd589f58b70f4204c5215645056b379a2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Document the example showing the benefits of using bindable propertiesSona Kurazyan2021-12-021-0/+14
| | | | | | | | | | | And mention the example in the bindable properties docs. Pick-to: 6.2 Task-number: QTBUG-97655 Change-Id: I676e90dbda66c2e718c7f6c2240fac608a8653df Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVarLengthArray: make static if's constexprMarc Mutz2021-12-021-5/+5
| | | | | | | | | | | Cleaner. Probably also more efficient at compile time, who knows? Also more consistent, since _some_ static if's were already constexpr'ed. Change-Id: I9657f7cf2166975f562db52e9f90630aaf412986 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: More Self-Encapsulate FieldMarc Mutz2021-12-011-3/+5
| | | | | | | | | | | Two more instances where we can use public API instead of accessing the data members directly. Amends 9d79e5f26ca58e7ddbb6367de044d05192107a4d. Task-number: QTBUG-84785 Change-Id: I2037339383836b0d292b3362fe1d6b056638e81a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use config from the main ABI when building ABI-specific external projectAlexey Edelev2021-12-011-0/+9
| | | | | | | | | | ABI-specific external projects should use the same config as the one is used by the "main" ABI. Task-number: QTBUG-88841 Change-Id: If7a1834d9a3f238f6dadd05323ccc0cf8552128c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix QFuture continuations/handlers to work with move-only callablesSona Kurazyan2021-12-011-8/+43
| | | | | | | | | | | | | | | | std::function, which is used to store the type-erased continuation lambdas, requires the passed callable to be copy-constructible. This makes impossible to use move-only callables with continuations/handlers. In particular, it makes impossible passing lambdas that are capturing move-only objects. The workaround is to store the continuation lambda inside a wrapper for the callable, which stores the move-only lambda in a QSharedPtr and can be stored in std::function, since it's copyable. Pick-to: 6.2 Fixes: QTBUG-98493 Change-Id: I8b7a22fcf68dc132b3c533216a7a1665e9f9fb0a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: simplify default ctorMarc Mutz2021-12-011-1/+4
| | | | | | | | | | | | Instead of calling the QVLA(qsizetype) ctor and letting the optimizer and inliner have a field day on them, simply set the trivial values for a, s, and ptr manually. Mark it as noexcept. Task-number: QTBUG-84785 Change-Id: I011826eacdaf63a4c37b21465e5fe4a6e70a1ab7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix the path to the build dir when creating an androiddeployqt depfileAlexey Edelev2021-11-301-1/+14
| | | | | | | | | | According to the CMake documentation any relative paths in DEPFILE should be relative to the CMAKE_CURRENT_BINARY_DIR if the CMP0116 is set to NEW. This also forces CMP0116 to NEW if the policy exists. Pick-to: 6.2 Change-Id: I3d697b008ea06effb2247bc204da9bcc4e9046b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add _make_aab targetAlexey Edelev2021-11-302-8/+34
| | | | | | | | | | | | | | | | Add target triggering AAB creation. Since the _make_aab target is not added to the ALL set, we may avoid dependency check for it and admit that the target is "always out of date". [ChangeLog][Android][Platform Specific Changes] Add the extra _make_aab targets for each executable target, that can be used to generate android app bundles. Also add aab metatarget to build all _make_aab targets that are created in the project. Pick-to: 6.2 Fixes: QTBUG-96710 Change-Id: I3b0c7fbb5a7dd493ca7a124c4e4b91fd857386bd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QString::arg: deprecate use of arbitrary Unicode digits as replacementsGiuseppe D'Angelo2021-11-301-4/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only documented replacements for Q*String*::arg() are sequences like %1, %2, %3 -- where the n-th number is expressed using a sequence of ASCII digits [1]. The code parsing the replacements however used the QChar::digitValue() function. That function simply checks if a QChar has a *Unicode digit value* (no matter what its block/category is), and if so, returns the corresponding digit value as an int (otherwise returns -1). The result of this is that a sequence like "%¹" or "%१" actually triggered substitutions (both count as "1"). Similarly, QChars with a digit value would be parsed as part of longer sequences like "%1²" (counting as "12" (!)). This behavior is weird, undocumented, and extremely likely the usual backstabbing by Unicode by using "convenience" QChar methods -- that is, never *intended* by the implementation. This commit deprecates (via warnings) such usages, which for the time being are left working as before (in the name of backwards compatibility). At the same time: given it's extremely unlikely that someone would be deliberately relying on this behavior, it implements the desired change of behavior (only accept sequences of ASCII digits) starting from Qt 6.6, that is, after the next LTS. Throughout Qt 6's lifetime users will still be able to control arg()'s behavior by setting an env variable, but that variable (and the support for Unicode digits) will disappear in Qt 7. To summarize: * Qt 6.3->6.5: default is Unicode digits, env var to control * Qt 6.6->6.x: default is ASCII digits, env var to control * Qt 7: only ASCII digits, no env var [1] That's the name Unicode gives to them, cf. https://www.unicode.org/charts/PDF/U0000.pdf [ChangeLog][QtCore][Deprecation Notices] The arg() functions featured in Qt string classes have always been documented to require replacements tokens to be sequences of ASCII digits (like %1, %2, %34, and so on). A coding oversight made it accept sequences of arbitrary characters with a Unicode digit value instead. For instance, "%2੩" is interpreted as the 23rd substitution; and "%1²" is interpreted as the 12th substitution. This behavior is deprecated, and will result in runtime warnings. Starting from Qt 6.6, arg()'s behavior will be changed to accept only ASCII digits by default. That means that "%1²" is going to be interpreted as substitution number 1 followed by the "²" character (which does not get substituted, so it gets left as-is in the result). Users can restore the previous semantics (accept Unicode digits) by setting the QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG environment variable to a non-zero value. In Qt 7, arg() will only support sequences of ASCII digits. Note that from Qt 6.3 users can also set QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG to zero; this will make arg() use ASCII digits only, in preparation for the future change of defaults. Change-Id: I8a044b629bcca6996e76018c9faf7c6748ae04e8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>