summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle even more include in enum casesFabian Kosmale2021-08-062-2/+6
| | | | | | | | | | | | | | | The solution in d3ed7dac8aa2f4ede0c409254b9dd44842086be0 was needlessly complicated, and broke a valid use case. The issue of no identifier being available to parse after the include has been processed can instead be solved by moving the test for the closing brace after the include processing. Fixes: QTBUG-94790 Change-Id: Ieec4b89e1d117637f11479e8bddc4060f93da43d Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 87973325f1b99f2b25a5a0224e623803872ce2ef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QXpmHandler: actually limit characters-per-pixel to fourMarc Mutz2021-08-061-2/+5
| | | | | | | | | | | | | | | | | | | | The following code assumed, and all comments indicated, that the cpp variable was limited to a max of 4. Yet, as coded, cpp could be five, in which case the XPM would be corrupt, as the header suggested five characters-per-pixel while the data was formatted in only four. Add a warning and error out when we encounter this situation. [ChangeLog][QtGui][QImage] Instead of writing a corrupt file, rejects to write XPM files with more than 64^4 colors (more than four characters per pixel) now. Change-Id: I458873cf7d179ab2e2dacd4c17dc837d640591a9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 71334c324e702c434d446e5fc329294c97b8516d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve WM_DPICHANGED handlingMorten Johan Sørvig2021-08-064-53/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resize QPlatformWindow on DPI change, so that QWindow size can stay approximately constant. For example, a 100x100 QWindow at 100% scaling will have a 100x100 QPlatformWindow. If the scaling is changed to 200% then the QPlatformWindow is resized to 200x200, while the size of the QWindow stays at at 100x100. In practice the QWindow size will also change slightly, due to inaccuracies in how we adjust for the size of the non-client window area. This will be addressed in a later commit. We can get DPI change independently of screen change, so no resizing should happen in screen change events. Disable the resize code in QGuiApplication for Q_OS_WIN, and remove the WithinDpiChanged flag. The new flow for handling DPI change is: 1) Send screen change (if any), so that the correct screen will be used when calculating scale factors during the following resize. 2) Resize the native window, which will trigger geometry change events, possibly also for the QWindow. 3) Resize child windows; WM_DPICHANGED is sent to top-level windows only. Fixes: QTBUG-89294 Change-Id: I0e2d44bae72d20ebdafc3d410db7be9964ad851b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 6336b5350b68e6430a7585d6658a9d653689186f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Track current window DPIMorten Johan Sørvig2021-08-064-0/+15
| | | | | | | | | | | The WM_DPICHANGED event gives us the new DPI, but we also need the current DPI in order to determine the scale factor corresponding to the DPI change. Change-Id: Ia61388415f57aa739397d3125b8751952e8fd392 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit f9883865606b7b31396f673fd07a163d911c61f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix link error to qFuzzyIsNull()Nico Vertriest2021-08-061-4/+5
| | | | | | | Change-Id: I17d890d4d61199dd74598ffa4c670ed65894047c Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 7d7b484429f2a8a23b0d15e5fbfca18f6553b1bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Clean up tst_blacklistTor Arne Vestbø2021-08-058-141/+16
| | | | | | | | | | | | | | | | | | | | | | | | 33d7f76f0e847d7e0fb00dd6056e7bba45b8b1e7 attempted to exercise more of the blacklisting code, but in doing so didn't account for the fact that the features it added didn't actually work. Adding a global blacklisting of * will result in blacklisting all tests, regardless of any inverse conditions "!*" later on, such as for the 'pass' test. This would have been evident by looking at the expectation files, which still showed the test as a BPASS. The broken feature should be fixed, but in the meantime let's clean up the test so it doesn't misrepresent reality. At the same time we also remove the messages() tests, which was copied straight out of tst_silent, but doesn't serve any purpose for the blacklist selftest. Change-Id: I20e4693300aad5e9ff5f17ad22e3dfcb5c49fd0e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit a71b9c937719bc3a5f4de6e91dbdbe364df38cac) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Don't report additional 'pass' test point for blacklisted XFailTor Arne Vestbø2021-08-052-5/+4
| | | | | | | | | | | Regression after 9906cc57ed3eed64d534f43c677bb16e08561bb6. Change-Id: I5566f70c66d248426c7a41b6de1cfb92f104cc64 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit c95d7741b74bc617d86297dbfa5cd7d1df98f8c3) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Report skipped tests in JUnit reporter as <skipped> elementsTor Arne Vestbø2021-08-0553-157/+122
| | | | | | | | | | | | | | | | | | The Apache Ant and Surefire Maven specs document a <skipped> element that can be used to signify skipped test, with a corresponding total skipped test attribute on the <testsuite>. The element includes an optional message attribute, documented in the Surefire spec, and in the Ant source code, but not yet documented in the reverse-engineered Ant spec: https://github.com/windyroad/JUnit-Schema/pull/11 Task-number: QTBUG-95424 Change-Id: Ib6417a41b9c328836f4017e6ebf7f7e9cd91288d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit fb16a66b71250f83a9249a0a04064f56d70c9fd3) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Don't report JUnit errors attribute without any <error> elementsTor Arne Vestbø2021-08-0529-29/+28
| | | | | | | | | | | | The errors attribute on the <testsuite> element represents the number of <error> elements, but we do not produce any at the moment. Task-number: QTBUG-95424 Change-Id: I7196d622a9a6bbb7e79ed2c2886984d539abb1da Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 58f1c0c146aa678b8140cc17388b5e7f3997fcc6) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Sync up QTest::LogElementType with element namesTor Arne Vestbø2021-08-052-3/+5
| | | | | | | | | | | | | | 539553a57216c4ece292ff54fb623807c334cdb6 renamed the LET_Error element enum to LET_Message, without renaming the corresponding "error" element name. This was not an issue in practice, since we never write the actual element in QTestJUnitStreamer, but the two should be in sync to avoid any confusion. Change-Id: I6c29f5303393b5f36b2f9877940bf3f6eaf3b7d2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 5a483656bca949f6c31b5da5339fa5cbe1dfac76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Reduce JUnit test duration reporting to millisecond precisionTor Arne Vestbø2021-08-051-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original Ant JUnit reporter produced test durations via Double.toString(), supporting arbitrary precisions, and the de-facto schema declared them as xs:decimal. Sadly, the now popular Maven Surefire reporter limited the duration to millisecond precision, and hard-coded this into its schema as SUREFIRE_TIME: https://issues.apache.org/jira/browse/SUREFIRE-1533 Unfortunately this definition spread into tools such as the Jenkins xUnit plugin, which relies on the schema provided by Maven Surefire: https://issues.jenkins.io/browse/JENKINS-52152 As a result, anything that produces higher precision results will not validate in the Jenkins xUnit plugin. Other test frameworks have bitten the bullet and reduced their precision correspondingly, e.g.: https://github.com/catchorg/Catch2/issues/2221 https://github.com/catchorg/Catch2/commit/581c46249acf8389e9 We follow suit, and our JUnit XML output now validates against both the Jenkins JUnit and xUnit plugins, as well as the original Apache Ant de-facto schema. Task-number: QTBUG-95424 Change-Id: I3097d10c03c2a29709960372301b29055d224e10 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bb74e72aa92b599cb4c80c23161ce9b66639ec01) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Improve JUnit XML conformanceTor Arne Vestbø2021-08-0555-868/+1165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JUnit test framework did not initially have any XML reporting facilities built in. Instead, the XML report was generated by the Apache Ant JUnit task: https://github.com/apache/ant/search?q=filename%3AXMLJUnitResultFormatter.java Many users interacted with these reports via the Jenkins JUnit plugin, which provided graphical visualization of the test results: https://plugins.jenkins.io/junit/ Due to the lack of an official XML schema for the Apache Ant JUnit report there was some confusion about what the actual format was. People started documenting the de-facto format, both as produced by Ant, and as consumed by Jenkins: https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd https://github.com/junit-team/junit5/search?q=filename%3Ajenkins-junit.xsd The XML produced by the Qt Test JUnit reporter was far from these schemas, causing issues when importing results into tools such as Jenkins, Allure2, or Test Center. The following changes have been made to improve conformance: - The 'timestamp' attribute on <testsuite> is is now in ISO 8601 local time, without any time zone specified - The 'hostname' attribute on <testsuite> is now included - The 'classname' attribute on <testcase> is now included - The non-standard 'result' attribute on <testcase> has been removed - The non-standard 'result' attribute on <failure> has been renamed to 'type' - The <system-out> element on <testsuite> is always included, even when empty - The non-standard 'tag' attribute on <failure> has been removed. Data-driven tests are now represented as individual <testcase> elements, e.g.: <testcase name="someTest(someData X)" ...> <testcase name="someTest(someData Y)" ...> <testcase name="someTest(someData Z)" ...> The resulting XML validates against both the de-facto Apache Ant 'JUnit 4' schema and the Jenkins JUnit plugin schema. Task-number: QTBUG-95424 Change-Id: I6fc9abedbfb319f2545b99b37d059b18c16776ff Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 973e74399e807fb6f351a7d330c8c8b85b66bc5a) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QStringLiteral: suppress the clang-tidy warning about const_castThiago Macieira2021-08-051-4/+14
| | | | | | | | | | | We can't add the comment inside the macro, so we solve the problem by adding an extra level of indirection. Change-Id: Ib8fbfcfeb48a49ca945dfffd169829b3610f6a34 Reviewed-by: Rui Oliveira Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit ae0b080c019025c2a949cf9468294ecf2b4eacb1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Simplify JUnit test loggerTor Arne Vestbø2021-08-0510-92/+35
| | | | | | | | | | | | | | - Use the right name for the attribute (AI_Message), rather than fixing it up in QTestJUnitStreamer. - Don't pretend that we're adding line and file information, only to discard it in QTestJUnitStreamer. - Don't pretend to add benchmark information, only to discard it in QTestJUnitStreamer. Change-Id: Ib6eadc12300157216fe9c6e8bcfebd7eb8a3ea68 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 177d259782f228257a376e3e87b30da6ad96f3fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add whitespace to Android error messageKai Köhne2021-08-051-3/+3
| | | | | | | Change-Id: I9c7729a7bef4a659b10fe69a73b30f101cbba546 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 74d0b1b1b914268700bee95b76f31b2d02b0c82a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove unsupported, host-related options from configure shell scriptKai Köhne2021-08-051-17/+0
| | | | | | | | | This amends commit d9a9eca54d. Change-Id: I762090ac9c7ea15a176efe4eb6d39d5c4b653726 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 00b7679d7a4f1d4c173ad9ad68875c22ebe76d6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QXpmHandler: fix re-entrancy bug in xpm_color_nameMarc Mutz2021-08-051-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The xpm_color_name() function returned a pointer to a function-static buffer. This is infamously non-reentrant, and an actual problem, because we explicitly allow QImage operations (incl. saving to an .xpm) from non-GUI-threads. Fix by using the CSS pattern (Caller-Supplied Storage; also used in the QAnyStringView(char32_t) and QAnyStringView(QStringBuilder) ctors) to force the caller to allocate storage in its own stack frame. As a consequence, we re-gain re-entrancy, but the returned pointer is now only valid until the end of the full-expression, which necessitated simplifying one caller (sorry!). To see why said simplification is valid, observe that xpm_color_name() writes a (now-explicit) NUL into returnable[cpp] and the old code read max(cpp, 4) characters from xpm_color_name()'s result. NB: cpp can be 5, even though the code comments say otherwise! :( [ChangeLog][QtGui][QImage] Fixed a race condition when concurrently writing .xpm files. Change-Id: I36d7173d53839a52f5cdf58324474c1b32c71f33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 73fabadcee71af858388fb245fccf4e96d4ead4e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shift iOS a11y translations into C++ fileMike Achtelik2021-08-044-1/+122
| | | | | | | | | | | | lupdate cannot parse .mm files. Therefore tr markup must be inside of C++ files. This copies the same approach qtconnectivity uses, see 6b2fd04b7be4494767b6092a030607010d91310c Change-Id: I9853864b4b81b48da763a387c78c102857f23047 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit c99849d0bc72df31ffde26c9ebffbf152cfcaeae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Pass on file location on failure, but don't assume we have oneTor Arne Vestbø2021-08-0451-101/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We try our best to pass on the file location of a failure, including for fatal errors, but the reporting or logging machinery should not assume there is one. By passing on nullptr for the file location we allow the logging backends to decide how to handle the situation, e.g. by not emitting extra fields for failure location. This effectively reverts c25687fa0b6e4be043e1f8c92c093d8b06ca06c4, in favor of relying on the backends to cope with null filename, which they already did. As qFatal uses QMessageLogger, which by default disables file/line information in release builds, we need to explicitly enable this in our self-tests, to get uniform test results. Similarly, we disable file/line info from testlib itself, as reporting Qt internal file and line information for user diagnostics is less useful. The odd one out there is qtestdata.cpp, which still ends up in test output due to using QTEST_ASSERT instead of qFatal for its diagnostics. Cleaning up that, and unifying how we report testlib issues to the user, is left for another day. Change-Id: Ib9451b8eed86fe3ade4a4dcaf0037e1a3450321c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit fa8cffa4c97d2e46de9af6f5e91af9212e372204) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Deprecate QWARN() in favor of qWarning()Tor Arne Vestbø2021-08-0526-48/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | The QtTest best practices documentations recommends using output mechanisms such as qDebug() and qWarning() for diagnostic messages, and this is also what most of our own tests do. The QWARN() macro and corresponding internal QTest::qWarn() function was added when QtTest was first implemented, but was likely meant as an internal implementation detail, like its cousin QTestLog::info(), which does not have any corresponding macro. This theory is backed by our own QtTest self-test (tst_silent) describing the output from QWARN() as "an internal testlib warning". The only difference between QWARN() and qWarning(), besides the much richer feature set of the latter, is that qWarning() will not pass on file and line number information in release mode, but QWARN() will. This is an acceptable loss of functionality, considering that the user can override this behavior by defining QT_MESSAGELOGCONTEXT. [ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning() Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit bef57b317f2efc0e73f2275d594be9d69f5a75d0) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QProperty: Force inlining of addObserverFabian Kosmale2021-08-041-1/+1
| | | | | | | | | | | | | | | The method is only called in two places: observerProperty (which only takes care of calling unlink, too, if necessary) and in registerWithCurrentlyEvaluatingBinding_helper. In the first case, the method most likely gets inlined anyway. In the latter case, we really want to avoid the overhead of an additional function call to speed up registration of the property with the binding. Considering that it is an internal method, there is no need to worry about code explosion. Change-Id: I3f0f0e37108f3859321d3b432e37fc8da3c15dc0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 77d528f8d328d43fa367bd4887ad21b5e6b6311e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid superfluous QBindingStoragePrivate::get callFabian Kosmale2021-08-041-1/+3
| | | | | | | | | | If we have no currentBinding, then registerWithCurrentlyEvaluatingBinding will not do anything. Thus we can completely avoid fetching the storage. Change-Id: Ic20142e4c4e09752b5c41b959f66080e6885e6c3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit b8e1782b670a10fe551669bdce654025acba225f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: micro optimizationsFabian Kosmale2021-08-042-3/+8
| | | | | | | | | | | | | | - Ensure that the allocateDependencyObserver fast path is inlined. - Use addObserver instead of observerProperty; we know that a freshly allocated observer does not have its prev pointer set. If prev weren't a private member, we could simply use Q_ASSUME(ptr->prev == nullptr), but making it public or befriending the class seems like a bad idea, as it grants too much access to the internals. Change-Id: Ia845f2807c70512563f7b9e1ecb85fe82b66208c Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 5d0095b1c2e60ecfb492c1910df70021128d663c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid TLS access for groupUpdateDataFabian Kosmale2021-08-044-7/+23
| | | | | | | | | | | | By putting the groupUpdateData pointer into the same thread local as the binding status, we avoid having to fetch two thread_local variables. Moreover, we can reuse the caching mechanism which we have in place for QBindingStatus to avoid costly TLS lookups. Change-Id: Iaea515763510daab83f89b8e74f35a80965d6965 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 71fea09e1a8d1fc5d9cca7c504f45b77725c0e21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Avoid TLS lookup if we are in the same threadFabian Kosmale2021-08-044-1/+18
| | | | | | | | | | | | | | | | | | | If the QBindingStatus we receive from the QObject is from the thread which is currently running, we do not need to refetch the thread local; the reason we refetched the thread_local was after all only to guard against the case where a QObject's property gets read in a different thread. To determine whether we are in the same thread, we can store the thread id in the thread_local structure. Currently, it only gets initialized for the main thread in QCoreApplication (as bindings are mostly used there). At a later point, we could either expose initBindingStatusThreadId, or call the function when a QThread gets started. Change-Id: Id8eb803973bb083abfab83a62bfccc9e88a4e542 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 460700f7736ae308bcbaa37f512355d09876dc8b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Enforce minimum CMake version in user projectsAlexandru Croitor2021-08-049-53/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces new behavior to error out when configuring user projects if the CMake version used is too old for Qt to work with. The main motivator is the requirement of new CMake features to ensure object libraries are placed in the proper place on the link line in static builds. The minimum CMake version is computed based on whether Qt was configured as shared or static libraries. At the moment the required versions for building and using Qt are the same. The minimum versions are defined in qtbase/.cmake.conf in the following variables QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC Qt Packagers can disable the version check when configuring Qt by setting QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT and QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT. In this case it is the packagers responsibility to ensure such a Qt works correctly with the specified CMake version. User projects can also set QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT to disable the version check. Then it's the project's developer responsibility to ensure such a Qt works correctly. No official support is provided for these cases. Implementation notes. The versions required to build Qt are stored in QtBuildInternalsExtra.cmake whereas the versions required to use Qt are stored in a new QtConfigExtras.cmake. Also the policy range variables stored in QtBuildInternalsExtra.cmake are now regular variables instead of cache variables, to properly allow overrides per-repository. Some renaming of functions and variables was done for a bit more clarity and easier grep-ability. Task-number: QTBUG-95018 Change-Id: I4279f2e10b6d3977319237ba21e2f4ed676aa48b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6518bcc167d47e1c27d082c21551b9a838b04e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Bump min required CMake version for static Qt builds to 3.20Alexandru Croitor2021-08-043-25/+45
| | | | | | | | | | | | | | | | | | | | | | | | Building a static library Qt configuration will now require a minimum CMake version of 3.20. Qt builders and packagers can still opt out of the mentioned minimum required version by configuring Qt with QT_FORCE_MIN_CMAKE_VERSION. Such a Qt configuration is /NOT SUPPORTED/. To facilitate these changes, the minimum version check has been moved to happen after the BUILD_SHARED_LIBS option is computed by either QtAutoDetect.cmake or set by a user provided cmake toolchain file. Introduce a new QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT variable in .cmake.conf to mark the minimum version for a static Qt build. Task-number: QTBUG-95018 Change-Id: Idc1875729f26a7c635b6bd26ac0c1be973917c13 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit 9aa0d99e66b8be2be75d4f3b7fce2b94db9a1e32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFileSystemModel: cache the name filters regexpsGiuseppe D'Angelo2021-08-042-12/+33
| | | | | | | | | | | | | | | | | | | | | | In order to filter out file names based on the user's settings, QFileSystemModel used to have a loop that tested if a given file name matched one of the filters. The problem is that each filter (a wildcard) was converted to a QRegularExpression _inside_ the loop. This causes a quadratic behavior (number of files * number of filters). Instead, build the regexps once when the filters are set (or the case sensitivity is changed, as that affects the filtering), and simply _use_ them in the loop. Simplify and correct some related code as a drive by. Done-with: Jean-Michaël Celerier Fixes: QTBUG-95383 Change-Id: I6bc336364c145bb05793a8f867545d7715d35832 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 07057188e3e42246cf006b43963d0bdcdaa159f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMetaType: auto-unregister converters and mutable views againMarc Mutz2021-08-041-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | The port from hand-rolled function storage to std::function inadvertently removed the helper variable of static storage duration whose dtor would unregister the conversion function. This caused QTBUG-94831, where the cleanup of conversion functions attempts to call code (via std::function) from a library that has already been unloaded. Restore the 5.15 behavior by adding a static-storage-duration scope guard to unregister the conversion and view functions from Qt upon library unload (when static objects are destroyed). Unlike 5.15, only install the scope guard upon successful registration, ensuring that only the DLL which successfully registered its conversion function unregisters it again. Amends 0e4ae4fbf8e320d18c29a55b5db2bba25b3d9d50. Add some strategic std::move()s as a drive-by. Task-number: QTBUG-94831 Change-Id: I391ca667420cf0d98a166676b9bb363d6e190306 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit fa7f4c5efd91c852341dd2e56396ee3f5fedd33a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Consolidate documentation of floating-point formatting codeEdward Welbourne2021-08-047-212/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the documentation of the format and precision parameters to QLocale::toString(double, char, int), reference it from various QString methods (instead of repeating there and referencing one of those from QLocale). Add brief first lines for various documentation comments. Mention the special handling of negative precision in the moved documentation. Mention QLocale::FloatingPointShortest, add its type to \sa lines of methods it affects. Change a comment on some code implementing its special treatment to make clear that it does apply to 'e' and 'f' formats, not only to 'g', even though it has no overt special handling in that code; and update docs to report the undocumented behavior the comment previously described. Document how infinity and NaN are represented. Be somewhat more consistent about single-quoting the format names where referred to and applying \c to character constants. Make clear what things are different between different methods using these parameters. Reference QString::number() from QByteArray's relevant methods, since they share its quirks. In the process, rename the format and precision parameters of relevant functions so they're consistently named, replacing a mixture of abbreviated forms. Change-Id: I077521b30346000e4b4f6968a8e750e934f72937 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b61a6e2507dd362b9b0478fc3b06c9a8f4a2977a)
* QLibraryInfo: Add MSVC 2022Mårten Nordheim2021-08-041-1/+3
| | | | | | | | Change-Id: Ie66effde6832152ee2903c467269a2822ded6653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 11476e5403c0f0ed997f0ecc9e5a82501441a667) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid to call _qt_internal_set_up_static_runtime_library() twiceLi Xinwei2021-08-036-7/+4
| | | | | | | Change-Id: I28985470b3e0b88befbbd2d62a027670d7d6c822 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a25144394910d07d0819c4da5aae058b0912a312) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use correct MSVC runtime library for targets created by qt_add_*()Li Xinwei2021-08-031-0/+3
| | | | | | | | | | | | Use _qt_internal_set_up_static_runtime_library() to set correct MSVC runtime library for targets created by qt_add_executable(), qt_add_library(), qt_add_plugin() and qt_add_big_resources(), to bring convenience to user projects. Change-Id: Ia49f1e90989c464820824be3e1eef3df1351cdcf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 74083c239db8ac65f143187ba9cafa11262d427b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString::localeAwareCompare: adapt to QLocale::setDefault() being calledThiago Macieira2021-08-033-4/+25
| | | | | | | | | | | | | | | | | | Because we're using a thread-specific global static, we need to recreate the QCollator type every time setDefault() is called. Since one is stored per-thread, we simply increment a generational counter and check that the next time that QString::localeAwareCompare is called in each thread. The issue was introduced on f6425da424b1a0d5927ee56fa657a9b31ca5afd1 (5.12) even though we were supposed to be using QCollator since commit 5279134935e858e6fa8565c936b17e88d7bded50 (5.3). Fixes: QTBUG-95050 Change-Id: I7e0b82c2d2fe464082d8fffd1696a8c9f74e5b30 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 94de5f9b25e1816039885c765e2a5b312f7daa7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray: don't coerce negative to unsigned for any baseEdward Welbourne2021-08-023-11/+11
| | | | | | | | | | | | | | | | | This follows up on commit 98666c8afc80cccb80ca4426b97ec52916c6e610, which did the same for QString. If someone wants to get formatting suitable to an unsigned value, they can cast the value to that unsigned type and the correct overload shall pick it up. [ChangeLog][Important Behavior Changes] QByteArray's formatting of negative whole numbers to bases other than ten now, like QString's (since Qt 6.0), formats the absolute value and prepends a minus sign. Task-number: QTBUG-53706 Change-Id: I91fee23d25ac0d5d5bcfcbeccbac1386627c004a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 260168d9d7547a2e7586bff6cb42e11d54c9d06e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix PerMonitorV2 DPI aware NonCLientAreaScaling handlingMorten Johan Sørvig2021-08-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | | The value returned from shouldHaveNonClientDpiScaling() controls two related behaviors: 1) Should Qt call user32dll.enableNonClientDpiScaling() 2) Should Qt code treat NonClientAreaScaling as enabled. Commit c35643db updated shouldHaveNonClientDpiScaling() to account for the fact that PerMonitorV2 always enables NonCLientAreaScaling, with the intent to disable 1) However this also disables 2), which was not intended. Instead, make shouldHaveNonClientDpiScaling() always return true when PerMonitorV2 is enabled, and then also omit calling the user32dll API in this case. Change-Id: I1d06f36a3d06becc667351fadcb00ab28af6ec4b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit ee68257b61268ef8f5f4c9b4090d8a1624cd98ce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* rhi: Be more graceful when one destroys a resource after the QRhiLaszlo Agocs2021-08-028-127/+306
| | | | | | | | | | | | | | | | | | | | | | One is a bad application or library in this case, but nonetheless we should handle this more gracefully then just crashing due to the QRhi already having been destroyed. Mainly because in Qt 5 one could get away with the same: releasing OpenGL objects underneath, for example, a QSGPlainTexture with no (or wrong) GL context did not generate any user visible fatal errors. So we should not crash in Qt 6 either with these code bases. In debug builds or when QT_RHI_LEAK_CHECK is set, one will get the unreleased resources warning printed in Qt 6, which is a step forward compared to Qt 5. So there is still some indication that something is badly designed, even if the application survives. Task-number: QTBUG-95394 Change-Id: I944f4f425ff126e7363a82aff926b280ccf1dfc3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit b594374ba84da986c5ebc93984961040338465d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Stop relying on balanced CGDisplay reconfiguration callbacksTor Arne Vestbø2021-08-023-84/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using CGDisplay callbacks to determine when a screen reconfiguration had happened, and when it had propagated to changes in NSScreen.screens, so that we could update our QScreen view of the world. Unfortunately the CGDisplay callbacks were not deterministic enough to use as a signal for when a reconfigure had completed. Since we can't rely on NSApplicationDidChangeScreenParametersNotification either (it comes in too late), we're now resorting to updating our QScreens at every chance we get: - On every CGDisplay reconfiguration ending - On QCocoaWindow::windowDidChangeScreen() as a result of AppKit moving the window. - On NSApplicationDidChangeScreenParametersNotification - On QCocoaScreen::get() as a last resort Since the result of these updates are only reflected as QScreen property updates or QGuiApplication signals if a change actually occurred, it should be safe to update early and often. Task-number: QTBUG-77656 Fixes: QTBUG-80193 Change-Id: I98334a66767736d94ad2fcb169e65f0d8bc71a30 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 6e250179229ebe7e2a056ba0e363592f4d1f6972) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Bump project versionsAlexandru Croitor2021-08-022-2/+2
| | | | | | Fixes: QTBUG-95454 Change-Id: I2467d3ae27b54424e59a7a4ab00d364eaec517d5 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* CMake: Bump min required CMake version for shared Qt builds to 3.16Alexandru Croitor2021-08-023-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building a shared library Qt configuration already required a minimum CMake version of 3.16, because we depend on CMake's Autogen.json files which are used for metatype.json file generation. If a lower version was used, a FATAL_ERROR was issued in qt6_extract_metatypes. This change is essentially moving the check to happen earlier in the qtbase configure process. User projects will now /also/ officially require a minimum of 3.16 (up from 3.14). As a consequence, the min/max version policy range that is set in the public QtFooConfig.cmake files is changed from 3.14..3.19 to 3.16..3.20 The upper bound is raised because building and using Qt works fine with all CMake 3.20 policies set to NEW. [ChangeLog][CMake] Building Qt as shared libraries now requires CMake version 3.16 or later. Building user projects with CMake using that Qt installation also requires a CMake version of 3.16 or later. Task-number: QTBUG-95018 Change-Id: I77d2829370f1dfc90b4071bebc8a3ade654e59e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 42970e490af00cd9baff1c54f4f00d982b21586a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass QDeadlineTimer by value in runOnAndroidMainThread()Assam Boudjelthia2021-08-022-5/+3
| | | | | | | | | Also change the timer default value to use QDeadlineTimer::Forever. Change-Id: Ia6d0101872a5d01b04e146cd9b2f90315cb8eb2e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 50f53b90220707664947f3d1f9468c466398ec31) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Register mouse devices on cocoaShawn Rutledge2021-08-016-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It would have been nice to ensure that a device is registered already in mouseEnteredImpl(); but in that context, NSEvent.deviceID is always 0, and we can't find out anything else about the device. QWindowSystemInterface::handleEnterEvent() doesn't currently take a QPointingDevice either. In handleMouseEvent() and scrollWheel(), deviceID seems unique for each trackpad or Magic Mouse, but 0 for any plain USB mouse. There, the first mouse that the user interacts with becomes primaryPointingDevice(): its deviceID is assigned to systemID (except if deviceID == 0, we use 1 instead, to avoid the auto-incrementing device ID assignment in the QInputDevicePrivate ctor.) When scrolling occurs, we update the capabilities to have PixelScroll if theEvent.hasPreciseScrollingDeltas. So over time, QInputDevice::devices() should build up to a complete list, with capabilities() also distinguishing plain mice from those that have the PixelScroll capability. And in the common case that the user has only one Apple pointing device, it becomes primaryPointingDevice(). Task-number: QTBUG-46412 Task-number: QTBUG-63363 Task-number: QTBUG-72167 Change-Id: Id9771b4dfd765e49023bd57d42a2aa4d0635a3b2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 69c833dae91d004b48f815e0156d6caeb4cdb491) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update QAbstractItemModelTester::FailureReportingMode documentationTor Arne Vestbø2021-08-011-2/+1
| | | | | | | | | | | The key part of FailureReportingMode::QtTest is that it will result in a test failure (via QTest::qVerify); not that it's using the QtTest logging machinery. Change-Id: I18472fba173ce1323748f1f87301a4defa87020e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 07d8885cccdb759532715598e18ecbe1c1282d25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocalSocket: do not emit aboutToClose() twiceAlex Trotsenko2021-08-013-2/+3
| | | | | | | | | | This signal is emitted by the QIODevice itself, so we don't have to forward it from the internal socket. Change-Id: I85745f36d7a27d92f339a9184de3b6e5d46f6f34 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 21f3ff65b8df777b5726a68b09bbee39f1a893ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QIODevice: fix converting OpenMode flag in debug outputAlex Trotsenko2021-07-311-3/+3
| | | | | | | | | | | | | | Suppress error: src\corelib\io\qiodevice.cpp(791): error C2440: '<function-style-cast>': cannot convert from 'QIODeviceBase::OpenMode' to 'quint32' Change-Id: I6b6e94790942d3af62bc2f38afad97c0b3c80817 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 6e3897b9fa0e03c8fbb1e97341fd4109c5a31658) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove mention of permission api in http exampleAssam Boudjelthia2021-07-301-8/+0
| | | | | | | Change-Id: I8b22633e1ad5372f92f87315b7184a4b499a0a0b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 0edda211f9a333b322ab5b6d0156271f4d460ece) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove app permission API from QCoreApplicationAssam Boudjelthia2021-07-306-423/+33
| | | | | | | | | | | | | | From the API review session, a potential deadlock behavior might occur when using QFuture's synchronous APIs on the UI thread. Also the fact that this api currently have an implementation only for Android. For those reasons we thought this API could be postponed until Qt 6.3, when the QFuture concern is addressed and other platforms other than Android are implemented as well. Change-Id: I1aef025488c24791da85d15fb57367d3e5e681be Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 72e5b36e2e4c79dc7995f0203968503266b4f2f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows QPA: Remove DwmIsCompositionEnabled() usagesYuhang Zhao2021-07-301-29/+5
| | | | | | | | | | | | | | | According to Microsoft Docs [1], DWM composition is always enabled and can't be disabled since Windows 8. Now that we are cleaning up pre-Windows 10 code, this apparently needs to be removed as well. [1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled Task-number: QTBUG-84432 Change-Id: I64dc049e0741600c8d0ae4db0e9e3bc98a211339 Reviewed-by: André de la Rocha <andre.rocha@qt.io> (cherry picked from commit 2c6bc06267b2599d491d5c84b29a368e6a922bc1) Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* testlib: Regenerate test expectationsTor Arne Vestbø2021-07-308-63/+64
| | | | | | | | | | | After c25687fa0b6e4be043e1f8c92c093d8b06ca06c4 and 539553a57216c4ece292ff54fb623807c334cdb6. Change-Id: I34b436f20b9c480f6948aa97430228936955808e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit f9170f56c7a0937547fc5dd60e90c52d72260ef8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Update a few remaining instances of the deprecated -xunitxml formatTor Arne Vestbø2021-07-304-20/+29
| | | | | | | | | The format was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 7c14223b1e21a3e19a0f84c772c0c8ca49dfe74f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>