summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Refix for avoiding huge number of tiny dashesEirik Aavitsland2021-08-101-4/+4
| | | | | | | | | | | Previous fix hit too widely so some valid horizontal and vertical lines were affected; the root problem being that such lines have an empty control point rect (width or height is 0). Fix by caculating in the pen width. Pick-to: 6.2 6.1 5.15 Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QGuiApplication: move two static variables from DATA to BSSMarc Mutz2021-08-101-2/+2
| | | | | | | | | | | | | | | | | The {mouse,touch}DoubleXDistance variables were initialized to -1, which forces them into the DATA segments. But this value is completely unused, since these variables are also set in initThemeHints(), called from QGuiApplicationPrivate::init(), before their only user, QGuiApplicationPrivate::processMouseEvent(), can possibly execute. By changing the default value to 0, then, we allow the compiler to place these variables into the BSS segment. Change-Id: I86144559ee2410b844f70a4f2499c8d3140d14cf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMetaStringTable: disable copy and moveMarc Mutz2021-08-101-0/+1
| | | | | | | | This class is an algorithm, and shouldn't be copied or moved. Change-Id: I6f517f53a242dbfd61975ef885c358eef139a272 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* macOS: Fix leaked NSMutableArray in applicationActivationChangedTor Arne Vestbø2021-08-081-1/+1
| | | | | | | | | The +[NSObject new] method is a combination of alloc and init. Fixes: QTBUG-95619 Pick-to: 6.2 6.1 5.15 Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-0661-62/+80
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* testlib: Don't report blacklisted tests as failures in JUnit reporterTor Arne Vestbø2021-08-061-2/+0
| | | | | | | | | | | | | We don't produce <failure> elements for them, so we shouldn't include them in the total count of failures. In the future we might produce <skipped> elements instead, but for now remove the incorrect increment. Pick-to: 6.2 Change-Id: Ia89a5cdaf79f6aa2f92be53180112c40ad6da2c6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCalendar: Delete registered calendar backends on program exitIevgenii Meshcheriakov2021-08-062-17/+76
| | | | | | | | | Add code to check if the calendar registry is destroyed to all QCalendar methods that dereference QCalendarBackend pointer. Pick-to: 6.2 Change-Id: I9b562355e2e0579396b52968f6065c6927cc9ca8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCalendar: Thread-safe calendar backend registrationIevgenii Meshcheriakov2021-08-0615-416/+499
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All calendar backend accounting was moved into QCalendarRegistry class (renamed from Registry). Calendar backends are no longer registered inside constructors, because in multithreaded environment this may lead to incompletely initialized instances becoming visible via QCalendar API in multithreaded environment. All system backends are registered by QCalendarRegistry itself when they are needed. New method QCalendarBackend::registerCustomBackend() is provided to register any 3rd-party calendar backends. Registration by names was also simplified. The list of names is now passed to QCalendarBackend::registerCustomBackend(). The checks are provided to ensure that all system backends have non-conflicting names. Name conflicts for custom backends are resolved in favor of earlier registered backends, as it is already the case in the existing code. The documentation was updated to reflect that. Method QCalendarBackend::names() was added to query the list of names associated with a backend after it is registered. Calendar backend deregistration was completely removed because it is not possible to perform it safely without reference counting. Fixes: QTBUG-93004 Pick-to: 6.2 Change-Id: I0ab1eccc02fdd1e1c66b5e5dd076c93de32d5a49 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Qt namespace: add a Qt 7 note about enumerator orderMarc Mutz2021-08-061-0/+1
| | | | | | | | | | | | | LayoutDirectionAuto is the default in qguiapplication.cpp's layout_direction. Because the numeric value isn't zero, it forces the variable into the DATA segment instead of the more efficient BSS one. At a less technical level, LayoutDirection{} should really produce the default, Auto, instead of LeftToRight. APIs have been changed for lesser violations of inclusivity :) Change-Id: I06b42f0bc00ea539805280ef0aa9694e6d739f41 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: Support BINDABLE for private propertiesAndrei Golubev2021-08-061-1/+8
| | | | | | | | Hopefully we won't need it but let's have it still at least for consistency Change-Id: I72289e65e5e5613174ad4d98cf8d614f9caae8e6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QXpmHandler: clean up write_xpm_image: cut out the QBA middle-manMarc Mutz2021-08-061-4/+3
| | | | | | | | | | | | Instead of appending to a QByteArray and then streaming that one, just stream the components of a line directly. QTextStream's op<<(const char*) is not subject to QT_NO_CAST_FROM_ASCII, etc., so can be used unconditionally. Change-Id: Idd97a75a1b5b939de7176d40880a2f328d01927d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Fix name of current test case element in JUnit reporterTor Arne Vestbø2021-08-062-10/+10
| | | | | | | Pick-to: 6.2 Change-Id: I0bd77e5f1d0540b87568a0c69a4b96442d4000eb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Write failure details as <failure> content in JUnit reporterTor Arne Vestbø2021-08-062-7/+25
| | | | | | | Pick-to: 6.2 Change-Id: Ica48769e7dfcabdc4bc8f0ed058bc22e29a0b632 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* testlib: Indent CDATA element in JUnit reporterTor Arne Vestbø2021-08-061-1/+1
| | | | | | | | | | The data itself is not indented, as consumers may read it as verbatim data. Pick-to: 6.2 Change-Id: Ia934616cea273feadc3a45d7c74726d4f804f0dc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QString/QByteArray: Fix setNum docs and add testsMårten Nordheim2021-08-061-2/+1
| | | | | | | | | Amends 260168d9d7547a2e7586bff6cb42e11d54c9d06e Task-number: QTBUG-53706 Pick-to: 6.2 Change-Id: I01c8cdc6a3cb46ec8e49e15ad71b6d707c0d272f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QInputDeviceManager: make QT_NO_KEYWORDS-cleanMarc Mutz2021-08-061-1/+1
| | | | | Change-Id: I1ba43c4dce82a8488e51c471fa3409fc08be1529 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add native interface for X11 application, exposing display and connectionTor Arne Vestbø2021-08-068-13/+137
| | | | | | | | | | | | | | | | | | | | | The major use-case of the now private QX11Info from Qt X11 Extras was getting hold of the Xlib display and XCB connection, for example in KDE: https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=QX11Info A new native interface for QGuiApplication has now been added that exposes these two properties, e.g.: if (auto *x11App = app.nativeInterface<QX11Application>()) qDebug() << x11App->display() << x11App->connection(); To avoid type clashes one of the enum values of QXcbNativeInterface's ResourceType had to be renamed. Pick-to: 6.2 Task-number: QTBUG-93633 Change-Id: I2e366a2bb88bd3965ac6172ad000ae32209f43e7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Turn off feature timezone for emscriptenEdward Welbourne2021-08-061-0/+1
| | | | | | | | | | We don't (yet) have a workable back-end for it. Pick-to: 6.2 5.15 Task-number: QTBUG-95314 Change-Id: I8cf0fd11f315bc7d6cac351d485f4cbc676ed95d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Tidy up QString's replaceArgEscapes() helper functionEdward Welbourne2021-08-061-13/+8
| | | | | | | | | | Eliminate wasted space, add spaces required by coding style, reflow an arithmetic expression to read more gracefully. Change-Id: Id04dfc7710f5cdb560a8d4655608139fb4c36191 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* replaceArgEscapes(): rework nested conditional to avoid repetitionEdward Welbourne2021-08-061-3/+4
| | | | | | Change-Id: I42306cb38d745bde33b93d3f66e86f19f58a868a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* replaceArgEscapes(): correct a comment and assert what it relies onEdward Welbourne2021-08-061-3/+4
| | | | | | Change-Id: I1d0c82b1cac0d59bd1fbda65f6a3e5be346b4c70 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* replaceArgEscapes(): rework local variables to make code simplerEdward Welbourne2021-08-061-9/+7
| | | | | | Change-Id: I188dc6f7a0d81d8587cc5a750d8773c3d389644f Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* replaceArgEscapes(): use qsizetype in place of int ant uintEdward Welbourne2021-08-061-5/+7
| | | | | | | | | | The uint, particularly, was requiring some contortions to avoid getting a "negative" value, where using qsizetype makes it harmless, as the resulting loops are then no-ops. In the process, document the slightly eccentric semantics of one of the retyped variables. Change-Id: Idaad4cfde9ed9d24e1bcbf03c2bdb10b62e07916 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* replaceArgEscapes(): use a local variable to avoid duplicationEdward Welbourne2021-08-061-13/+4
| | | | | | | | | | | Two blocks of code branched on the same local variable and, in each block, one branch acted on a C-locale text, the other a localized version, but doing the same to each in the two branches. Branch to set a variable to the selected text so that we only have to write the code to do each branch's actions to that one text. Change-Id: I8bbc1210f2c14b19f41a9974c7b6ec2ae612cc70 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QCoreGlobalData: use QHash, not QMap, for dirSearchPathsMarc Mutz2021-08-062-3/+2
| | | | | | | | | No user of the variable iterates over the container, they only manipulate or inspect individual entries, so order doesn't matter. If order doesn't matter, use the more efficient QHash over QMap. Change-Id: Id28913a57bb14eb328e668624f236f76cad86def Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Handle even more include in enum casesFabian Kosmale2021-08-061-2/+1
| | | | | | | | | | | | | | 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 Pick-to: 6.2 6.1 5.15 Change-Id: Ieec4b89e1d117637f11479e8bddc4060f93da43d Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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. Pick-to: 6.2 6.1 5.15 5.12 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>
* QInputDeviceManager: ++explicit, ++out-of-line-dtorsMarc Mutz2021-08-062-1/+4
| | | | | | | | | It's private API, but exported, so de-inline the dtor to pin the vtable in QtCore instead of potentially duplicating it in every plugin that uses the class. Change-Id: Ia948985bb94677c8453a8e7be27a14085303aaf5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* 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 Pick-to: 6.2 Change-Id: I0e2d44bae72d20ebdafc3d410db7be9964ad851b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* 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. Pick-to: 6.2 Change-Id: Ia61388415f57aa739397d3125b8751952e8fd392 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Doc: Fix link error to qFuzzyIsNull()Nico Vertriest2021-08-061-4/+5
| | | | | | Pick-to: 6.1 6.2 Change-Id: I17d890d4d61199dd74598ffa4c670ed65894047c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QXpmHandler: clean up write_xpm_image: use conventional pointer arithmeticMarc Mutz2021-08-051-6/+3
| | | | | | | | | | | | | | ... instead of *(array + index). Also fix a pointless cast from QRgb to int which the next line implicitly undoes (because colorMap has QRgb as key, not int) and get rid of the local variables that facilitated said fallacy in the first place. Change-Id: I71a92822ee2404646f6fb5533e40252f38e6b21f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QXpmHandler: clean up write_xpm_image: scope variables betterMarc Mutz2021-08-051-5/+4
| | | | | | | ... and fix spacing around operators and after flow-control keywords. Change-Id: Iefaa03074536d13a655c91fb42aef6aa96c2665b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QXpmHandler: avoid double-lookupMarc Mutz2021-08-051-9/+14
| | | | | | | | | | | | | | | | The code used the if (!contains()) { insert() } anti-pattern, necessitated by Qt's deviation from the STL of allowing insert() to overwrite an existing entry, causing two lookups of the same key. Since QMap these days is a wrapper around std::map, fix by using the real thing (a std::map) instead, which sports the non-broken insert() semantics already, avoiding the need to play tricks like detecting a size increase in order to find whether an insertion took place. It also simplifies the loop later on, and we can transparently use pmr, when available. Change-Id: Iedd8d5691514a7705a55c27376446304b20af071 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringLiteral: suppress the clang-tidy warning about const_castThiago Macieira2021-08-041-4/+14
| | | | | | | | | | We can't add the comment inside the macro, so we solve the problem by adding an extra level of indirection. Pick-to: 6.2 Change-Id: Ib8fbfcfeb48a49ca945dfffd169829b3610f6a34 Reviewed-by: Rui Oliveira Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* testlib: Don't report additional 'pass' test point for blacklisted XFailTor Arne Vestbø2021-08-051-3/+3
| | | | | | | | | | Regression after 9906cc57ed3eed64d534f43c677bb16e08561bb6. Pick-to: 6.2 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>
* testlib: Report skipped tests in JUnit reporter as <skipped> elementsTor Arne Vestbø2021-08-054-4/+18
| | | | | | | | | | | | | | | | | 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 Pick-to: 6.2 Task-number: QTBUG-95424 Change-Id: Ib6417a41b9c328836f4017e6ebf7f7e9cd91288d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Don't report JUnit errors attribute without any <error> elementsTor Arne Vestbø2021-08-051-1/+0
| | | | | | | | | | | The errors attribute on the <testsuite> element represents the number of <error> elements, but we do not produce any at the moment. Pick-to: 6.2 Task-number: QTBUG-95424 Change-Id: I7196d622a9a6bbb7e79ed2c2886984d539abb1da Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@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. Pick-to: 6.2 Change-Id: I6c29f5303393b5f36b2f9877940bf3f6eaf3b7d2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* 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. Pick-to: 6.2 Task-number: QTBUG-95424 Change-Id: I3097d10c03c2a29709960372301b29055d224e10 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Improve JUnit XML conformanceTor Arne Vestbø2021-08-054-68/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* testlib: Simplify JUnit test loggerTor Arne Vestbø2021-08-055-74/+26
| | | | | | | | | | | | | - 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. Pick-to: 6.2 Change-Id: Ib6eadc12300157216fe9c6e8bcfebd7eb8a3ea68 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QXpmHandler: clean up write_xpm_image: make w,h constMarc Mutz2021-08-051-1/+3
| | | | | | | ... and use one variable definition per line. Change-Id: Ie8e6d6fb9e570cf715ab0b39c78d677f1e5a19a7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* replaceArgEscapes(): rename a local variable and simplify initializationEdward Welbourne2021-08-051-6/+4
| | | | | | | | | | The name coincided with one used in other functions for a different meaning and its initialization was clumsy. Rename to a terser name that communicates the relevant matter more clearly. Change-Id: I6baf8e5ec695cbbb1cc10f6c4b4cc6512c1aefc4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Add whitespace to Android error messageKai Köhne2021-08-051-3/+3
| | | | | | Pick-to: 6.2 Change-Id: I9c7729a7bef4a659b10fe69a73b30f101cbba546 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Pre-check a pair of string comparisons by lengthEdward Welbourne2021-08-051-1/+5
| | | | | | | | | | | | | | When checking whether a floating-point value is "inf" or "nan", the code actually only checked they *started* with those. Check the length first and thereby avoid the check when the string is longer in any case. This incidentally avoids tripping over any string that merely starts with "inf" or "nan" - such a string should not be able to arise here; but we still shouldn't give it the special treatment reserved for these two, were one to arise. Add an assertion to the one remaining branch that wouldn't have caught such a malformed string. Change-Id: I63828e3a99a33cf236e4d1a2e247ad832b7a00fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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. Pick-to: 6.2 6.1 5.15 5.12 Change-Id: I36d7173d53839a52f5cdf58324474c1b32c71f33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTestEventLoop: stop when the test failsEdward Welbourne2021-08-052-4/+8
| | | | | | | | | | | | | | | | | | | | | | It makes no sense for the event loop of a test to keep running after a test has failed. This lets test code simply use the usual testlib macros to compare and verify values in asynchronous tests that would otherwise need to hand-test values and send a signal on failure (that the main test can connect to an event-loops quit() or equivalent). For example, QLocalSocket's benchmark simply uses the usual macros, without doing anything to stop its event loop if they fail, with the sad result that, when a test fails, it does so repeatedly and then times out, causing the test program to be killed without running later tests. With this change, that test code (once converted to use QTestEventLoop) is able to exit gracefully on the first failure. [ChangeLog][QtTest][QTestEventLoop] The QTestEventLoop new exits its event loop as soon as the test is known to be failing. Task-number: QTBUG-91713 Change-Id: If0d455741668722034906763025dda496d2afbb4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFsFileEngine (Unix): replace a QPair with a proper structMarc Mutz2021-08-042-4/+8
| | | | | | | | | | | | The comments in the declaration of the pair screamed "I want to be a struct with properly-named member variables", and the code that read it->first and it->second was really misleading to STL-aware readers. Fix by defining a small struct with member names taken from unmap()'s use of the pair's fields. Change-Id: Ie18852a3147f65cf14cfc5a3bb633f7b3e78f5a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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 Pick-to: 6.2 Change-Id: I9853864b4b81b48da763a387c78c102857f23047 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>