summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Forward COMPILER_LAUNCHER to the ABI-specific external projectsAlexey Edelev2022-06-291-0/+8
| | | | | | | | | | This allows to speed-up the build of external projects. Change-Id: I3bbdbd6ec5b0920c9e912cb59a6e16c5a8efa0ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit c7231177df71879b6d3ebc48288a6d3d8fdab6d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use the main ABI's CMAKE_MAKE_PROGRAM in ABI-specific external projectsAlexey Edelev2022-06-291-0/+4
| | | | | | | Change-Id: Ie35b6a334be419d3182fe77f9d70153cd1fd8a51 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f2d9e76451ffb4f890a97cb218fd733fb5960111) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* moc: fix const-init for WindowsThiago Macieira2022-06-291-1/+2
| | | | | | | | | | | | | | | | | | | References to __declspec(dllimport) is not a constant expression on Windows, so we can't have a direct reference to a staticMetaObject. Commit 9b8493314dd77f3e96b353187816bb7ef4dedbb5 fixed the Q_OBJECT parent link (added in 5.14, kicked in for 6.0 with the ABI break), but commit 656d6f2a9b221dbd5adfc46262cb243e696d8d62 added links for Q_GADGETs too without taking the need for Windows DLLs into account. This change is a no-op everywhere but Windows. On Windows, since we store the pointer to the indirect getter function, now you may get non- null pointers from QMetaObject::superClass(). Change-Id: I6d3880c7d99d4fc494c8fffd16fab51aa255106e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 688e8f63a2bb87469517166f90c50dec524f90c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmetatype.h: remove unnecessary specializationThiago Macieira2022-06-291-7/+0
| | | | | | | | | | Commit 5db3fd29b42ec06ccb15fdd7f274bb20c326ffb6 removed the expansions that likely needed this. Change-Id: I6d3880c7d99d4fc494c8fffd16fbbe8dcde4a1b1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 3335b541e76903f312cf71944a857c11e221c512) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMetaType: extern-template the built-in Core types' QMetaTypeInterfaceThiago Macieira2022-06-292-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This *should* make no difference in behavior, it just prevents the instantiation of the QMetaTypeInterface and all the lambdas used in it in every compilation unit, with a copy in every library. Now, a simple function like: QMetaType f() { return QMetaType::fromType<int>(); } produces only a single function, with a reference into QtCore: _Z1fv: movq _ZN9QtPrivate25QMetaTypeInterfaceWrapperIiE8metaTypeE@GOTPCREL(%rip),%rax ret The code above *does* work on Windows, producing: _Z1fv: movq __imp__ZN9QtPrivate25QMetaTypeInterfaceWrapperIiE8metaTypeE(%rip), %rax ret However, it breaks the staticMetaObjects' metatype listing, because getting the address of a __declspec(dllimport) variable is not a constant expression (it lacks data relocations). So this is disabled on Windows. This change also broke the INTEGRITY build. I've simply disabled the optimization there without attempting to understand why it fails. Task-number: QTBUG-93471 Change-Id: Id0fb9ab0089845ee8843fffd16f97748a00b4d64 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit dbf58407cb7f87b8d75ffd4e8af1393e80f30873) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProcess: re-enable pdfork() on FreeBSDThiago Macieira2022-06-281-1/+1
| | | | | | | | | | | The forkfd_pidfd is a Linux feature, but we ended up disabling the equivalent functionality on FreeBSD. Change-Id: I6d3880c7d99d4fc494c8fffd16fabfbc38865f94 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5e60b2ab160bc5ff3bc41bb8991753785d2fc285) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString(En|De)coder: Remove noexcept from ctor taking nameFabian Kosmale2022-06-271-2/+2
| | | | | | | | | | | | | It is necessary as the QStringConverter ctor is no longer noexcept, as it can now allocate memory. This change is ABI-wise safe, as the method was only changed to be noexcept in 6.4. Amends 122270d6bea164e6df4357f4d4d77aacfa430470. Change-Id: Ifab4302d659524e27f38f0f90e5813a2c2a4a452 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ba2ae1720a11692e2fc57c8be176f2dd9e126f2f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmetatype.h: add QT_FOR_EACH_STATIC_PRIMITIVE_NON_VOID_TYPEThiago Macieira2022-06-251-7/+7
| | | | | | | | | | | This allows us to simplify the explicit specialization of the QMetaTypeInterface<void> explicit specialization, dropping the warning push/pop, and remove an unnecessary explicit instantiation. Change-Id: Id0fb9ab0089845ee8843fffd16f9bdccf1965b95 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5db3fd29b42ec06ccb15fdd7f274bb20c326ffb6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmetatype.h: remove unnecessary EXPORT macroThiago Macieira2022-06-251-9/+2
| | | | | | | | | | | | | | | | | | | | It was introduced in commit d9f9bc9bada91e3ec2b6c496d3b2242506ca56bc for Qt 6.0 to avoid extern __declspec(dllexport), which MSVC doesn't like, but was made obsolete by commit 77b99e8111cdd06b4fe12f2e18950a1e40ee2b76 that removed the extern templates altogether for MSVC. This change is NOT a no-op because Q_CORE_EXPORT expands to Q_DECL_IMPORT which is __attribute__((visibility("default"))) on ELF platforms. That's actually a good thing, because the symbol is not defined in any library that is not called QtCore anyway. GCC and Linux are also going towards properly requiring imported symbols to be explicitly marked, which this is. Task-number: QTBUG-93471 Change-Id: Id0fb9ab0089845ee8843fffd16f99616883281e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 97fbf7d151fbadb2c4541a5e0689810584a9a210) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSettings: fix a typo in the docLaszlo Papp2022-06-251-1/+1
| | | | | | | Change-Id: I059f603f3cc66a40e84179ac3f2a07de3bf31761 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e35fc908fdb831e3aef9f539239662e434b1ef13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add QStringDecoder::decoderForHtml()Lars Knoll2022-06-253-18/+56
| | | | | | | | | | | | | | | Now that QStringConverter can handle non UTF encodings through ICU, add a way to get a decoder for arbitrary HTML code. Opposed to QStringConverter::encodingForHtml(), this method will try to create a valid string decoder also for non unicode codecs. Change-Id: I343584da1b114396c744f482d9b433c9cedcc511 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 9c1f3b6d4d5a5fe59396062c6f68cc1201665c62) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractItemModel: Add revisions to new methodsUlf Hermann2022-06-241-13/+13
| | | | | | | | | | | | These methods show up in QML-exposed types. They should be revisioned in order to keep those types backwards-compatible. Change-Id: I8e826dc2e7db49d8abe69f67605dfb1991855b96 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit c52e0a9582a0a06999d480b969b3b2895fe92217) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use [[noreturn]] attributeKai Köhne2022-06-231-1/+5
| | | | | | | | | | | | Use __has_cpp_attribute mechanism to check availability of [[noreturn]]. For MSVC 2019 and 2022, this is always the case, so we can also remove the (now dead) __declpsec(noreturn) definition. Change-Id: Ie7b39bd93bc5e1a173e245a3a5d5ff7e9067a59f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit bc06e345fe6e284e4dc72f3e02662641dcb9ed71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MSVC: Remove dead Q_DECL_DEPRECATED* definitionsKai Köhne2022-06-231-4/+0
| | | | | | | | | | | | | | | | | Later on we redefine them to [[deprecated]], [[deprecated("")]], if the attribute is available. Since both MSVC 2019 and 2022 support the attribute, the __declspec() definition was never used. https://docs.microsoft.com/en-us/cpp/cpp/attributes Fixes: QTBUG-93748 Change-Id: I3e12f2ace414e316a811f2ceb44e6f312803439a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit f921b42f34f254ca7066691f3cf4a1c7270f0161) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDom: Stop treating non-BMP characters as invalidSona Kurazyan2022-06-222-7/+10
| | | | | | | | | | | | | | According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters within the range of [#x10000-#x10FFFF] are considered to be valid, so fix the check for valid characters accordingly. This requires changing the loop over the input QString to iterate over code points (instead of code units). Fixes: QTBUG-104362 Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit da0d7f61c851431d14430684c62345bc23dbf001) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move QFutureInterfaceBase::cleanContinuation() to removed_apiSona Kurazyan2022-06-223-12/+19
| | | | | | | | | | | This method isn't used anymore, but we can't remove it entirely for BC reasons, because it was called from inline code. Change-Id: I9183c666c466030787ac7c2386706b50abf23eaa Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 73e1bc09e63394490d91a223b3479b46c1595d66) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QJsonValue: fix incorrect to{Array,Object} when the value is emptyThiago Macieira2022-06-223-10/+14
| | | | | | | | | | | | | This is a repeat of commit de6ced66920600e659dbaa2509526a3bcb0b3360 "QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4), which fixed the same thing for QCborValue. I've just copied the exact same implementation onto the QJsonValue functions. Fixes: QTBUG-104085 Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit e114fec62adf13b8c21ca890fb748cb27f391c25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QThread:idealThreadCount: fix build with FreeBSD 13.1Thiago Macieira2022-06-221-1/+1
| | | | | | | | | They added the CPU_COUNT_S macro. Change-Id: I6d3880c7d99d4fc494c8fffd16fabe9f8226ecda Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 45de3fedbac73bc8ff501117d64f19092e1b18b4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Long live QT_INLINE_SINCE!Marc Mutz2022-06-223-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have now had several requests for inlining previously-exported member functions, but no standard mechanism to effect it. As QT_REMOVED_SINCE has shown, there is great value in having such a standard mechanism, so here is one. With this change, to inline a previously exported (member) function, simply - mark the declaration with QT_<MODULE>_INLINE_SINCE - move the definition into the header file (outside the class), - wrap it in QT_<MODULE>_INLINE_IMPL_SINCE - #include the header into the module's removed_api.cpp Just including the header into removed_api.cpp is enough, so you may want to add a comment: #include "header.h" // uses QT_<MODULE>_INLINE_SINCE The effect is as follows: - A TU in a _different_ library will see an inline declaration, followed by the definition, and so it will see a normal inline function. - A TU in the same library will, however, see a non-inline declaration, to avoid the ODR violation that at least GCC/ld are able to detect. - When QT_<MODULE>_BUILD_REMOVED_API is in effect, the TU will also see the definition, which is the same setup as before the change, except in a different TU, and therefore export the member. - When, OTOH, QT_<MODULE>_BUILD_REMOVED_API is _not_ in effect, the TU will see no declaration, assuming (correctly), that the definition will be supplied by a different TU. This is, of course, an ODR violation, but not worse than what we do elsewhere, as the definitions differ only between library and user. The function is inline only for the users of the library, not the library itself, which will still see the function as non-inline. If inlining is critical within the library, too, the existing function should call a new inline function, and calls in the same library should be changed to call the new inline function instead. Use the new mechanism to inline the QLocale ctor we intended to inline for 6.3, but couldn't, because we hadn't found the magic incantation, yet. Thiago found it a few weeks later, and this is what this patch is based on. Fixes: QTBUG-100452 Change-Id: Ia0030cddc64b6b92edfed860170d5204aa74b953 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 97f643faee876cadb36f110ef5a96abf1b68acff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPostEventList: de-inline addEvent()Marc Mutz2022-06-222-17/+24
| | | | | | | | | | | | While in a private header, it did manage to place QList<QPostEvent> operations near the top spots of all Qt template instantiations in a QtWidgets build. Task-number: QTBUG-97601 Change-Id: I4fa1972b8764b71ad0559633131e7e44b3d4ae6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 1a030f6609ad6a9bbc1253e9e2d5efb198dc5998) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPromise: run continuation(s) on destructionSona Kurazyan2022-06-221-1/+1
| | | | | | | | | | | | | | | | | | | If the QFuture is canceled because the associated QPromise has been destroyed, we still need to run its continuations (i.e. onCanceled handler, if it's attached), so replaced the cleanContinuation() call inside ~QPromise() with runContinuation(), which will also take care of cleaning the continuation. [ChangeLog][QtCore][Important Behavior Changes] QFuture now runs its continuations when its associated QPromise has been destroyed. Previously, if a QFuture was canceled because the associated QPromise has been destroyed, its continuations were skipped. Fixes: QTBUG-103992 Change-Id: Ie05bc760c96c349aade8adb8d2fe5263aff8efac Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit bf3fc5c95cb4e6acedf242c00b7a1c3b455062bb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix concurrent access to files by androiddeployqt in multi-abi buildsAlexey Edelev2022-06-211-1/+29
| | | | | | | | | | | | | | | | | | | | | | | 'androiddeployqt' supposed to copy artifacts that may not have abi-specific identifies. One example is Qt6Android.jar file. We need to prevent execution of multiple androiddeployqt instances in parallel. External projects now are divided into two steps. The first runs the build and can be executed in parallel to the build steps from the other external projects. The second one triggers androiddeployqt and can only be run exclusively in relation to the similar steps from other ABI-specific external projects. To solve the issue we build the dependency chain between the all ABI-pecific qt_internal_${target}_copy_apk_dependencies targets to execute androiddeployqt sequentially. This is non-optimal, but guarantees that androiddeployqt is not running simultaneously with another instance in external projects. Fixes: QTBUG-104013 Change-Id: I39a25dd5f38ed988e0ca74b185024bc602ab81a1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 84e22f9e822cc71799bad01423cc407f2ea26fcd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qsimd: don't enforce shstk (CET) feature on launchThiago Macieira2022-06-211-0/+6
| | | | | | | | | | | | Clang with -march=tigerlake or -march=sapphirerapids pre-defines __SHSTK__, which QtCore require the feature, even if the OS does not have support for it. That's of no consequence because the compiler does not generate shadow stack operations on its own. Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit d531c4b65dc47312256f9de2786a852f6ac4c1f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Warn when using qt6_add_big_resources on iOSAlexandru Croitor2022-06-202-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qt6_add_big_resources works by calling rcc to generate a resource .cpp file, compiling it into an object file, then passing the compiled object file to rcc again for further manipulation. The path to the object file is passed to rcc using the $<TARGET_OBJECTS> generator expression. This generator expression does not work when used in add_custom_command / file(GENERATE) when targeting iOS, because CMake claims it does not know where the object file will be on-disk (presumably because the location is controlled by Xcode itself and it can vary based on the active architecture and sysroot). The following error is shown at generation time: Error evaluating generator expression: $<TARGET_OBJECTS:rcc_object_foo> The evaluation of the TARGET_OBJECTS generator expression is only suitable for consumption by CMake (limited under Xcode with multiple architectures). It is not suitable for writing out elsewhere. More details about the issue can be found at https://gitlab.kitware.com/cmake/cmake/-/issues/20516 Trying to work around the issue by manually invoking the compiler instead of using a genex so we know the location of the object file hits similar issues in that we don't know the active arch and sysroot for which to compile the object file. Until the CMake limitation is lifted or we find a different fix, warn that qt6_add_big_resources can't be used when targeting iOS and fall back to using qt6_add_resources instead. Note that qmake CONFIG+=big_resources also falls back to non-big resources mode when targeting Xcode (mac-xcode) and doesn't even show a warning. Another note is that using CMake + Xcode + qt6_add_big_resources does work when targeting macOS, although it generates some warnings warning same member name (qrc_assets.o) in output file used for input files: qrc_assets.o qrc_assets.o (due to use of basename, truncation, blank padding or duplicate input files) So there is some hope this could be fixed for iOS in the future. Fixes: QTBUG-103497 Change-Id: I91152247651ecd35e8110b8874399cb1b8b394bd Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 91fd8bdb116f461eec67bf8b17d41011039a63d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid misleading bindingStatusAllan Sandfeld Jensen2022-06-204-4/+5
| | | | | | | | | | | | Set it to nullptr on clear, and deal with possibly null bindingStatus. Task-number: QTBUG-101177 Task-number: QTBUG-102403 Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 0bd287627508c61a7abfd6430d8c1243ea153081) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Document QJniObject::constructVolker Hilsheimer2022-06-201-0/+15
| | | | | | | | | | Added for 6.4. Not extremely useful as long as the macros that allow the declaration of new class and type strings also being documented. Change-Id: I9ee466fdd0aaccec1e627ceb313b5a5c17e3f3fa Reviewed-by: BogDan Vatra <bogdan@kdab.com> (cherry picked from commit 145bfe6054f8f7fcc32d0442e8845aa59af2fc1a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Long live the ICU-based QStringConverter interface!Fabian Kosmale2022-06-202-9/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for additional codecs to QStringConverter when ICU is available. We store the converter in the state (d[0]), and its canonical name in d[1]. We need the name there, as in the clear function we close the UConverter, and set the pointer to null. Consequently, the actual conversion functions might need to re-open the converter again. The advantage of this approach is that clear is used in the destructor of State, and with this approach we properly clean up the state. There is however a disadvantage: The clear function was so far also used for resetting the state when QStringConverter::resetState . Discarding the whole Uconverter for that is however rather costly. For that reason we modify resetState to call a new function, State::reset. For existing converters, it behaves the same as clear; for the ICU based converter, we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can benefit from this more efficient version; code compiled against older Qt versions will continue to work, as the conversion functions can just recretate the converter from the name. We can distinguish between ICU and non-ICU converters by checking if the UsesIcu flag is set. QStringConverter::name is changed to return the name stored in d[1]. The interface of the ICU converter has a dummy name, so code using the old name function from QT < 6.4 still returns something, namely a message asking the user to recompile. The function is moved out of line, as we need to check for the private ICU feature, and want to avoid having that check in the public header. As the QStringConverter ctor taking a name now can allocate memory, it can no longer be noexcept. Removing the noexceptness is safe, as it was only added after Qt 6.3. Note that we cannot extend the API consuming or returning Encoding, as we use Encoding values to index into an array of converter interfaces in inline API. Further API to support getting an ICU converter for HTML will be added in a future commit. Currently, the code depending on ICU is enabled at compile time if ICU is found. However, in the future it could be moved into a plugin to avoid a hard dependency on ICU in Core. [ChangeLog][Corelib][Text] QStringConverter and API using it now supports more text codecs if Qt is compiled with ICU support. Fixes: QTBUG-103375 Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 122270d6bea164e6df4357f4d4d77aacfa430470) Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QOperatingSystemVersion: Add new Windows versionYuhang Zhao2022-06-202-9/+31
| | | | | | | | | And also update some docs to provide more detailed info. Change-Id: I7b51fcb6613399cb4f1dd5d75cf3168df195577b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7225ed749da2e60b3cdd9b509d0291a0e87ba94e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmetatype.h: remove #undef for something that was never #define'dThiago Macieira2022-06-181-1/+0
| | | | | | | Change-Id: Id0fb9ab0089845ee8843fffd16f976868e3ab448 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f23d83c43e1c4a462014f0d27596a06f7bc8bf13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMetaType: use explicit load/store operations on QBasicAtomicIntThiago Macieira2022-06-181-4/+4
| | | | | | | | | | QBasicAtomicInt::operator int() does loadAcquire() and operator=() does storeRelease(). Change-Id: Id0fb9ab0089845ee8843fffd16f9a1ece6823777 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4c1b1f2ad884455bdebc779b6dcab5dd3815a9c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Android: Fix 'qmldir file not found at' warningsAlexandru Croitor2022-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | androiddepployqt calls qmlimportscanner to find qml modules. Due to an issue in a generator expression, CMake did not write out the android default qml output directory to the deployment json file, which in turn means that qmlimportscanner did not get that information. When the scanner scanned the sources, it found some relative imports but couldn't find relevant qmldir files because they were in an android-specific directory. This caused warnings like 'qmldir file not found at /some/path' repeatedly. Fix the generator expression to use $<COMMA> instead of , so that the genex condition is evaluated successfully and the extra qml import paths are passed along to qmlimportscanner. Amends 76665f2a72857916667ebe6b04a804ed8abb5853 Fixes: QTBUG-102595 Change-Id: Ia74c3c80f12d05b0a9cd0978df1a58bb5582198a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 81b5395aef3bce878574fc26e4e75a4498f1c948) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix Xcode common dependency issues for other_files IDE targetAlexandru Croitor2022-06-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A generated file can be added to a resource target, which in turn adds it to the other_files target. With the Xcode generator, this can lead to errors like The custom command generating foo.txt is attached to multiple targets: foo_other_files foo_resources_1 but none of these is a common dependency of the other(s). This is not allowed by the Xcode "new build system". Neither of the targets depend on each other because logically they shouldn't depend on each other. And yet XCode wants that each generated file is attached only to one target, which will be a common dependency for the other targets. Make sure _qt_internal_expose_source_file_to_ide extracts and uses that common target dependency just like qt_add_resources -> _qt_internal_process_resource already does. One case of a common target dependency is the _lrelease target in qttools which was added in 5b0e765ab0dddba86662925cb44aeac748a286b7 Another case is in qt_add_shaders in qtshadertools. I expect we might encounter other cases where we need to introduce a common driving target. Task-number: QTBUG-103723 Change-Id: Ideff023718a6ce109a4b3eefa01bffa79d1c6a3e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 20dd4a43f08c5417c1b7751b66e8b3fa337ad01d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Document how to treat qt_add_big_resources args as source filesCristian Adam2022-06-162-0/+9
| | | | | | | | | | | | | | | The arguments to qt_add_big_resources are not known to CMake as source files. They need to be added explicitly to a CMake target in order for Qt Creator to treat them as source files and in the case of a qrc file to expand the contents in the project view. Fixes: QTBUG-104320 Change-Id: Iea755d998e8f9814a82983272731b0c654f80644 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 7037f4620fb59b669d32fbce0ef79aabe38a716a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSettings: Fix reading of the [%General] sectionhjk2022-06-161-1/+1
| | | | | | | | | | | The currentSection key was accidentally using the whole remaining section contents. Change-Id: Iec6e38636e519170eef136401ede4b626e12754a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 903a883044165b8f40f500684c437f4102031425) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qHash: pass QByteArrayView to qHash() by valueThiago Macieira2022-06-163-6/+21
| | | | | | | | | | | | | | The QBAV one should pass the parameter by value, like QStringView. And now that we have it, the non-View one should call the View one in an inline function, like we already do for QString. The extra, defaulted parameter is there only so we get a different signature in the new inline function compared to the removed one. Change-Id: If05aeeb7176e4f13af9afffd16e7f08062b1dc86 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit bc144312c18e7436275267ad8900fce980597c45) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix typos in docs and commentsKai Köhne2022-06-1510-15/+15
| | | | | | | | | | Found by codespell Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 9d2cc4dd766ca6538e17040b6ac845ed880ab0fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Fix QSettings when using content URLSamuel Mira2022-06-151-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | Using QSettings with Content URL in Android failed because of 3 issues: * the lock file assumed that it could append ".lock" to the file name for its name * the lock file assumed that it could write in the same directory as the file * the QSaveFile used by QSettings requires direct write on content URL but setDirectWriteFallback is set to false on QSettings by default This patch fixes those issues by, when it is an Content URL in Android, saving the lock file in QStandardPaths::CacheLocation and setting the setDirectWriteFallback to true. This does not break backwards compatibility because appending ".lock" to the Content URL will always make an invalid URL, so it did not work before. Fixes: QTBUG-103455 Change-Id: I92867577507b7069e4e6091d94e0931bb6dbcbed Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 140ca89a3c2b8d78889d27217f977cd4de10041b) Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix renameat2 configure checkVolker Krause2022-06-141-1/+1
| | | | | | | | | | | | Give this a chance to ever succeed by not using undefined variables in the test code. Found by a KDE unit test observing changes in inotify behavior between Qt5 and Qt6. Change-Id: Iceb743d88dfa093c02d76ce32ea5c8ced24bfc5b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 193039dff343139de4a83b7811c11927be63a4ed)
* Revert "qxp::function_ref: drop use of q23::invoke_r"Marc Mutz2022-06-141-3/+5
| | | | | | | | | | | | | | | | | | | | | This reverts commit b9cce12e76796962e5e5ad0d5408370af56af459, which broke function_ref<void(int)> f = [](int i) { return i; }; ie. swallowing of return types. We could maybe implement the same without invoke_r, with the same manual if-constexpr that invoke_r has, but it would be a pointless duplication across the two thunks we have, so just use invoke_r. Add tests. Task-number: QTBUG-103739 Change-Id: I6034f05d813c06a25e8058ded5b6b62f3ca858b4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit fa4d18b86c0cb0de495ce988fd9d3714e09b05dd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray: more GCC 12 -Werror=array-bound whack-a-moleMarc Mutz2022-06-141-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | This one came up on a tsan build, but not on an asan/ubsan one!?!: qbytearray.cpp: In member function ‘QByteArray QByteArray::toBase64(Base64Options) const’: qbytearray.cpp:3884:42: error: array subscript 1 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds] 3884 | chunk |= int(uchar(data()[i++])) << 8; | ~~~~~~~~~~^ qbytearray.cpp:37:24: note: at offset 1 into object ‘QByteArray::_empty’ of size 1 37 | Q_CONSTINIT const char QByteArray::_empty = '\0'; | ^~~~~~~~~~ cc1plus: all warnings being treated as errors Fix, as so often, by caching the size(). The code in 5.15 is different, but similar, so picking all the way. Task-number: QTBUG-103923 Change-Id: Iac30e964c8d7d367620d16db65ceeaade33ee6b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit de005e7976e4b110d6b5f32a8bab5141713acb7b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLibrary: fix use of deprecated QByteArrayMatcher::indexIn(p, n)Marc Mutz2022-06-141-1/+1
| | | | | | | | | | | Use the QByteArrayView overload instead. Deprecated since 6.3, so backporting: Change-Id: I529104cad59260eed371cedb1ae84a7e9086bbf6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 4e66c69bad1235d08d82de75d50617ad7d15a3ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Q*ApplicationPrivate: remove unused "flags" argumentsThiago Macieira2022-06-142-5/+5
| | | | | | | | | | | | | | | | | They weren't flags. They were the version of Qt that was used in compiling the application itself. The protection against rollback isn't necessary any more, since qversiontagging.h, which applies to everything and not just the main application binary. And using them to make decisions on functionality or behavior is misguided (see previous commit). This commit does not deprecate the front-end classes' argument. In the future, we may find some need for them. Change-Id: Ia4a094014ddb48cc9f6dfffd16f83a7b58ff95d3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit fb1e0eee078f3f797a72b38e6981348b5ae5810c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCoreApplication: Remove app_compile_versionThiago Macieira2022-06-142-10/+2
| | | | | | | | | | | | | It's not used for anything, so remove the temptation of trying to use it to make decisions at runtime about a behavior. It's the wrong tool for the job: it might tell you the version of Qt the *application* was compiled against, but not the version any of the Qt-using libraries were. Change-Id: I175efddd75f24ae59057fffd16f70b77dd87faf4 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit c4af4dcb5d41fa5d82f9e7986006202671f1681f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix doc and example of QLoggingCategory::installCategory()Edward Welbourne2022-06-132-14/+35
| | | | | | | | | | | | | | | | | | | | | | Snippet [22] was unused and the example using snippet [21] neglected to show how its oldCategoryFilter got initialized, which is what [22] does. But it turns out the example code was crashy in any case, as it left the oldCategoryFilter uninitialized (albeit probably null) until the call to installFilter() had returned, and installFilter() calls the new filter, so the new filter needs to check oldCategoryFilter before calling it. The doc also failed to explain why it's OK to not defer to the prior filter in these calls during installFilter(), so revise the doc and example so that the latter behaves sensibly and readers of the former are likely to use the function safely. This amends commit 8f0654ceb878b6c8a08c7f5b790027c26e007c13 which added the snippets and the use of one of them, but not the other. Fixes: QTBUG-49704 Change-Id: Iddb8d97b0bef417d8f16e7910730cfa59ea3e715 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 6ae2bfad411faf896fdca83a55db1e24a0b70e73) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix typosKai Köhne2022-06-131-2/+2
| | | | | | | | | Found by codespell Change-Id: I4907e423b6b345acf82f2d7e0ed62479719d694e Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 04cc705947a4f8e96f98f228a505774293c97840) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Document the CorePrivate moduleTopi Reinio2022-06-132-6/+16
| | | | | | | | | | | | | Classes to aid Android development are currently available in the CorePrivate module. In order to have correct information for the requisites table (for CMake and qmake inclusion), document the private module, mark it \preliminary, and link the classes to it using the \inmodule command. Fixes: QTBUG-103865 Change-Id: Id913148751ab925eb4e8488aa28a54b0e0c2d78d Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit e4f9a78c18039a013326307f4884eeb7e83bd976)
* Windows: fix DeferredDelete events processing on QThread::terminate()Vladimir Belyavsky2022-06-131-1/+12
| | | | | | | | | | | | | On finishing/terminating a thread, when processing posted events, we need to consider QThread's own data instead of caller thread's data. Otherwise we can get into unexpected situations such as double destruction of an object, premature destruction, etc. Fixes: QTBUG-103922 Change-Id: Idf77221ebbaa0b150ee2d0c296b51829ae8dc30e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 865212057b9f4e2809ebe42ec25c2d94d818cde7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray: de-inline to/fromStdString()Marc Mutz2022-06-132-8/+10
| | | | | | | | | | | | Removes another owning container manipulation that made the top entry in Clang -ftime-trace's most-expensive template instantiations in a QtWidgets build. Task-number: QTBUG-97601 Change-Id: I8c765ea2e6c46da5188b70c9503dd87e63f6b328 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d6575f37179aef80490f4ec03a61ab6f5033bd3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix data race in QCoreApplicationPrivate::sendThroughApplicationEventFilters()v6.4.0-beta1Marc Mutz2022-06-091-1/+1
| | | | | | | | | | | | | | | | | The assertion has the acquire fence at the wrong place: - QThreadData::thread isn't dereferenced, so the acquire fence on its load() isn't needed. - QObjectPrivate::threadData, however, _is_ dereferenced, so an acquire fence is needed; the relaxed load() is insufficient. Swapping the loadAcquire() and the loadRelaxed() fixes both issues. Change-Id: Iee964490e93ebc323c188e616bf0d448f91fb2b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 0da17e83ec507229e3516bbdc5986ab775dc843e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocale: use qsnprintf instead of deprecated sprintfMarc Mutz2022-06-081-1/+1
| | | | | | | | | | | | | Fixes warnings such as qtbase/src/corelib/text/qlocale_tools.cpp:321:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] from AppleClang. Change-Id: Ief10e99abfa0a56c24622ac79db719dde58a4210 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 2e9bc3494f62761660e6ae9b5cc6caa0e170ca9a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>