summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Android: guard getStateCount() with correct VERSION.SDK_INTv6.1.36.1.3Assam Boudjelthia2021-08-261-4/+7
| | | | | | | | | | | | | The call getStateCount() was introduced in 29, so cases for lower API should be handled. (Cherry picked from commit 538c7855e7d369a3d5aab9eb9815172847dd4e84) Conflicts: src/android/jar/src/org/qtproject/qt/android/ExtractStyle.java Change-Id: Ic1b9d018e1a0ec6a72a394bd14d3566b7fdb5258 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Adjust tst_qstringapisymmetry test dataJani Heikkinen2021-08-251-14/+0
| | | | | | | | | | | | | | | | | | This change removes test rows which starts failing after reverting commit be83ff65c424cff1. These rows were added as a part of commit ce0b76731042412a0fa5a5f6 which can't be reverted anymore. Fixing failing tests isn't possible because expected outcomes in tst_QStringApiSymmetry::indexOf_regexp_QStringView and tst_QStringApiSymmetry::indexOf_regexp_QString seems to be different in some cases after the revert. So dropping those few test cases seems to be only option. Fixes: QTBUG-94215 Change-Id: I2bee20e622d6a8652a03c9623d18c228d694992a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "QString::lastIndexOf: fix off-by-one for zero length matches"Jani Heikkinen2021-08-252-3/+3
| | | | | | | | | | | | This reverts commit be83ff65c424cff1036e7da19d6175826d9f7ed9. The revert is needed as commit caused a regression in QString::lastIndexOf and the regression is more critical than the original issue fixed by the reverted commit. Fixes: QTBUG-94215 Pick-to: 6.1 Change-Id: I785c39d4e0e73f38d5447942357eff0eb19e3f96 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidgetVolker Hilsheimer2021-08-183-4/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For high-precision wheel scrolling sequences, the widget that gets the first (typically ScrollBegin) event grabs the wheel. Qt directs all future wheel events within the same sequence (i.e. until ScrollEnd) to that widget. QGraphicsView passes wheel events through to the item under the mouse, and QGraphicsProxyWidget implements wheelEvent to forward a synthesized QWheelEvent to the embedded widget. Since QGraphicsView's viewport has already grabbed the wheel, any forwarded event would end up back in QGraphicsView, resulting in infinite recursion (if the assert doesn't fail first in debug builds). The correct fix requires that QGraphicsProxyWidget knows that this is a high-precision wheel event, allowing it to adjust the wheel grabber temporarily to the embedded widget. However, QGraphicsSceneWheelEvent doesn't provide this information. To fix the infinite recursion, mark the generated event as synthesized by Qt (but still send it spontaneously to enable propagarion within the proxy widget hierarchy). In QApplication's notification routine, interpret such events then to override the wheel grabber. Add a test case for the various scenarios. This 6.1 compatible fix does not pass all situations. A follow up commit that introduces the missing APIs to QGraphicsSceneWheelEvent then fixes those as well. Task-number: QTBUG-95552 Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 4982c872efef7ce8673ed257dce24b971e456a08) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Accept the QWheelEvent before each propagation stepVolker Hilsheimer2021-08-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Input events in Qt are accepted when constructed, and ignored by the default event handler (so overriding the event handler is enough to accept an event). Since we use the same QWheelEvent instance for each propagation step, we need to reset the event to be accepted before each delivery so that an earlier child ignoring the event doesn't result in the event being ignored without explicit acceptance. Amends the refactoring of wheel event delivery in 92df790f46b3a8b17aec2f385d6472fd3f8647f6. Task-number: QTBUG-95552 Task-number: QTBUG-79102 Task-number: QTBUG-67032 Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 1653ae13db69a2e703a1b44d3e67b55e927a5eca) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix hidden API access for Android styleAssam Boudjelthia2021-08-132-833/+787
| | | | | | | | | | | | | | | | | | | | Use public API and attributes to retrieve part of the Android style values instead of using reflection to access hidden or private fields. This latter method, was throwing lots of warnings or exceptions at the start of apps making it big annoyance to deal with. This patch doesn't handle drawables though, so the "full" and "default" Android style will be somehow broken still for now. For that reason, the default style extraction method is set to minimal to avoid getting warnings about it, and Fusion style could be used for Widgets apps, and for QML apps, it's recommended to use the Material style from Quick Controls 2. Task-number: QTBUG-71590 Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit b5b9c264ddff6c6eebb08038d9d3f2282df5c0ec)
* Doc: Ensure deprecated APIs in Qt Sql are documented as suchNico Vertriest2021-08-131-18/+18
| | | | | | | | | Added \deprecated where needed Fixes: QTBUG-94585 Change-Id: Id6d1fee1bbb6f8194e90a494673edef34530482b (cherry picked from commit fbf836657f06f2f302aaaf6bb6416f19d979f2aa) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* StyleSheet: Use rule for ComboBox in embedded QLineEditVolker Hilsheimer2021-08-121-6/+5
| | | | | | | | | | | | | | | | | | An editable combobox uses an embedded QLineEdit as an implementation detail. That lineedit should use the rules that are set for the combobox to render itself, similar to what was already implemented for the lineedit used in a QAbstractSpinBox. The containerWidget helper function provides the logic for identifying the container of the rendered widget, returning the QAbstractSpinBox or the QComboBox for an embedded QLineEdit. Use that method rather than duplicating the logic. Fixes: QTBUG-95631 Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit adafa5ee1f37739f33f6417f27c8ee7308aaad9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Ensure deprecated APIs in Gui are documented as suchNico Vertriest2021-08-1210-44/+70
| | | | | | | | Fixes: QTBUG-94521 Fixes: QTBUG-95310 Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5 (cherry picked from commit 111115bf8862b7cd1197c2ef8a4b475c882776d4) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Warn when using CMake 3.21.0 due to issue in AUTOMOC/AUTOUICAlexandru Croitor2021-08-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There can be cases where trying to incrementally rebuild an already built Qt will cause a ninja dependency cycle error due to incorrect dependency information created by AUTOMOC and AUTOUIC. Example error when building qtscxml tests ninja: error: dependency cycle: auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp -> auto/scxmlcoutput/default/ids1.h -> auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen -> auto/scxmlcoutput/default/CMakeFiles/tst_scxmlcoutput_default_autogen -> auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp Example error when building Qt Creator ninja: error: dependency cycle: src/shared/help/shared_help_autogen/include/ui_filternamedialog.h -> src/shared/help/shared_help_autogen/timestamp -> src/shared/help/shared_help_autogen/include/ui_filternamedialog.h Warn and advise to use a different CMake version instead. Change-Id: I6f529ba6a526663bc6ed699b1bfe8a9094129887 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 06c2400f5d439ce1f1945833d9b1895eff843855) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix memory leak if eXIf has incorrect crcRobert Löhning2021-08-102-4/+19
| | | | | | | | | | | | | | Change eb6767 from upstream repo. Fixes oss-fuzz issue 23376. [ChangeLog][Third-Party Code][libpng] Fix for possible memory leak in libpng was backported. Change-Id: Id0c2f8b8bd60438ae8b5a61c83b6e50d55c6eb65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 76e2409cc908d1fa6ee6c7ff61b699594244bf6c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslSocket - replace an old certificateTimur Pocheptsov2021-08-102-88/+84
| | | | | | | | | | | Helped quite a lot with OpenSSL 3 not accepting some old algorithms. Task-number: QTBUG-95123 Change-Id: If4894fa86eba7b002465fa661d436ae6ea751989 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 33de5f6502254ffe51960714404b6330dab224d5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* xcb: add a timeout control when reading INCR propertyLiang Qi2021-08-101-2/+6
| | | | | | | | | | | | | | | | | | | | For the first call of QXcbClipboard::clipboardReadProperty() inside of clipboardReadIncrementalProperty() in getSelection(), it will get a XCB_NONE reply before the contents arrived via property change. Then we give a chance to read more. Manually tested with following setups: * examples/widgets/mainwindows/application with gvim(gtk3) * examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on gtk2) and GIMP 2.99.6(based on gtk3 via flatpak) Fixes: QTBUG-56595 Done-With: JiDe Zhang <zhangjide@uniontech.com> Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 02248eea5562c1df39ee23f195011afacc6759b0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCompleter: QCompleter unexpectedly changes QLineEdit textTianlu Shao2021-08-101-0/+1
| | | | | | | | | | | | | | | | When qcompleter and qlineedit are used together, the currentcompletion() of qcompleter is its first item by default. Therefore, when qlineedit makes the initial value, then selects the text and enters, qcompleter will modify the default first item to qlineedit text. The judgment that completionprefix() of the completer is not empty is modified and added here, because completionprefix() is always empty when there is no match. Fixes: QTBUG-20894 Change-Id: Id47f7f4da0a93d03a4e7b056ec731615b0803d13 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tianlu Shao <shaotianlu@uniontech.com> (cherry picked from commit 0ef190fcc429405200d9f6063851726fcfb75637) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix build with CMake master / 3.22Alexandru Croitor2021-08-101-1/+1
| | | | | | | | | | | | | | | | | CMake master / 3.22 introduced a behavior change in how conditions are evaluated in the while command. It is now consistent with how if() evaluates conditions. This caused an issue in Qt code where a "(" opening parenthesis was evaluated as part of the condition rather than as a string. Fix this by wrapping the evaluation of the variable in quotes. Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit eb2282605734152440e840777d1f8a0576e3c7a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve docs for QFuture continuationsSona Kurazyan2021-08-102-49/+53
| | | | | | | | | | | | Replace phrases like "future has been running", "parent" with more precise descriptions. Fixes: QTBUG-95273 Change-Id: Ibd5a464007d41cc437da49ba250b9ea0a46078c6 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit d61820e5ab3176818b8a2326fa25d05a9f135244) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Refix for avoiding huge number of tiny dashesEirik Aavitsland2021-08-102-4/+35
| | | | | | | | | | | | 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. Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 84aba80944a2e1c3058d7a1372e0e66676411884) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit ab70aa362ee5dd5b1375b198dcd6d6445ab2daeb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslCertificate::verify - remove QSKIPTimur Pocheptsov2021-08-067-254/+121
| | | | | | | | | And re-generate certificates. Fixes: QTBUG-95429 Change-Id: Id970a0a9315d146d6dd1e66c9cff9b7d75657e2d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit e7ab17ade170a8fbc5061fffe5334b26cdc54ed3)
* 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>
* 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>
* 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>
* 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>
* doCrypt() - check the error codesTimur Pocheptsov2021-08-031-1/+5
| | | | | | | | | Disabled (moved into the legacy provider) DES-CBC results in a crash, when setting key length. Change-Id: Ie0b49424f11d8042ebecebfd3b6346263f730551 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b4942f7f0c56f2c5dcd783760a8c915463e8e744)
* Allow dragging of a floating dockwidget on macOS with a custom titlebarAndy Shaw2021-08-021-1/+1
| | | | | | | | | | | This amends 3224c6d7d150164241c13ccf7d47377a39c0a6bb to account for the case when the dockwidget is already floating. Task-number: QTBUG-70137 Change-Id: If8b345565b11b44beb3fb4b697cfe812c29c6396 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ba3e1fe09b7d921985e21d857a1d566465095e69) 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>
* Bump versionJani Heikkinen2021-08-023-3/+3
| | | | Change-Id: I2ba0fdc4eb1259c623eeaf6014a71fa9dcc46439
* 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>
* Fix QString test compilation without QRegularExpressionIvan Solovev2021-07-301-4/+113
| | | | | | | | | | | | The QString itself can be compiled without QRegularExpression, but the tests do not check if they are supported or not. This patch fixes the issue by introducing the proper #ifdef guards. Task-number: QTBUG-91736 Change-Id: I797691f78a34d4f78a86af99c78bf06e26e846d1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 59df5dacd55b607ec1b59864cfcc8ab86d38d537) Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QByteArray: extend unit testsIvan Solovev2021-07-292-27/+687
| | | | | | | | | | | | This patch introduces some test improvements to check the calls of different methods on an empty default-constructed string. Apart from that, many other tests are added to extend code coverage. Task-number: QTBUG-91736 Change-Id: If86ef3d8611a678798b1bcc60a1a4f5598fd2179 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 08a1bcfa9b6672d0b71f5b3de0d6c58a8f549ea1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray: fix indexOf/lastIndexOfIvan Solovev2021-07-292-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixed two bugs in indexOf/lastIndexOf: 1. The lastIndexOf(char, qsizetype) overload was crashing with an empty QByteArray. It was unconditionally calling lastIndexOfCharHelper() which assumes that this QBA is not empty. An explicit check for the empty case is added. 2. The indexOf(QByteArray, qsizetype) overload was behaving incorrectly while searching for an empty QByteArray. In this case it unconditionally returned its second parameter (from). However, from can be negative, or even exceed the size of this QByteArray. This patch handles this cases properly. As a drive-by: this patch adjusts the QByteArray::indexOf(char, qsizetype) and QByteArray::lastIndexOf(char, qsizetype) overloads to match with the QByteArrayView implementation. This is done to have similar code paths in both cases and avoid tricky bugs in future. Ideally we had to adjust the QByteArrayView implementation, but it's fully inline, so can't be changed without breaking BC. Task-number: QTBUG-91736 Change-Id: Iaef2fdc5b99cce6aa342cca2d17544a1ad7ca677 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e150bcfe4d5514b2a2960234049c514bc558adee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslCertificate::verify - skip auto-testTimur Pocheptsov2021-07-291-0/+2
| | | | | | | | | | | as a temporary fix for suddenly expired certificates situation (to be regenerated). Task-number: QTBUG-95429 Change-Id: I00ad11cfd8824eeeffa2991dfcda6a7899726953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8d0e4a2e5c3627e2fd88f14ccc8b349668012685) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Fix typo Ctr -> CtrlAlexander Volkov2021-07-281-1/+1
| | | | | | | Change-Id: I89c9526aa74b312dd67a6d194395b3298bbc31fe Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 0a8aa8c23e84ef5918dda15a9af9d582d5bfd9a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* [qgenericunixservices] Consider kde-open5 for opening URLsNicolas Fella2021-07-281-0/+2
| | | | | | | | | | | | | | When xdg-open is not found the KDE-specific kfmclient is considered. That however is part of Konqueror and may not be present as well. Plasma offers another option, kde-open5, which should be considered before falling back to webbrowsers. This is particularly for non-http URLs like tel: where opening in a webbrowser is not wanted. Change-Id: I2b606562e21568fbe43f4593de67a1d467918cc4 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 74a91773afa395ee0cefcdcd25bb3947b60a0b63) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QHash/QSet: fix squeeze() for default-constructed containerIvan Solovev2021-07-273-5/+11
| | | | | | | | | | | | | | | | | | | | | | QHash::squeeze() was unconditionally calling reserve(0), which is always allocating memory (even for 0 size). This was leading to a confusing situation when calling squeeze() on a default-constructed container with 0 capacity() actually allocated memory. This is very misleading, as squeeze() is supposed to free unneeded memory, not to allocate more. This patch adds a check for non-zero capacity. As a result, nothing is done for default-constructed container. Note that this patch also affects the QSet::squeeze() behavior, because QSet uses QHash as its underlying data type. Task-number: QTBUG-91736 Change-Id: Ib1c3c8b7b3de6ddeefea0e70b1ec71803e8fd3b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit b095d268788343b67a3995db7148dcc3af9bde1a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't report results when the results list is emptySona Kurazyan2021-07-274-0/+44
| | | | | | | | | | | | | | | | | | | When inserting items into the result store, a ResultItem is created, which stores a pointer to the results list and their size. If the size of the ResultItem is set to 0, it means that a single result is stored. In case of trying to report results via an empty list, the size is 0, so result store treats it as a single result. Added checks before storing the results to make sure that the result list isn't empty. Note that empty lists are allowed in some cases for the filter mode, because ResultStoreBase::addResults() knows how to handle those cases correctly. Task-number: QTBUG-80957 Change-Id: I399af4c3eef6adf82fea5df031fe9a9075006b1f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 08de1fb28153d8170b592796a84032897afa4206) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve fix for avoiding huge number of tiny dashesEirik Aavitsland2021-07-271-1/+1
| | | | | | | | | | Some pathological cases were not caught by the previous fix. Fixes: QTBUG-95239 Change-Id: I0337ee3923ff93ccb36c4d7b810a9c0667354cc5 Reviewed-by: Robert Löhning <robert.loehning@qt.io> (cherry picked from commit 6b400e3147dcfd8cc3a393ace1bd118c93762e0c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCryptographicHash test: remove the moreThan4GiBOfData(SHA512) check from the CIMarc Mutz2021-07-271-2/+5
| | | | | | | | | | | It timed out the other day on the CI. Even the SHA-1 check took 137s (with a 300s timeout). Skip the SHA-512 test on the CI, but keep it for manual runs. Change-Id: I49792ac9bcab6512e1803f66cd986b2830e634c0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit c6e092a5f84b7fc72556897b50c7697152967925) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Windows QPA: Fix coordinates reported through UI AutomationAndré de la Rocha2021-07-271-10/+7
| | | | | | | | | | | | | | | Conversion to/from native screen coordinates was incorrect and could fail for non-primary screens. This could cause a control's bounding rectangle to be incorrectly reported, or a search for a control based on its position within the window to fail, causing incorrect behavior with accessibility tools and other software interacting with the application using UI Automation. Fixes: QTBUG-91459 Change-Id: I5d56584ff26d977cdd34d35af46644e32aa11e7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0235c0217883bc9d0ca83c7533e9c0286901bb3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QVarLengthArray: extend unit testsIvan Solovev2021-07-271-3/+341
| | | | | | | | | | | | This patch introduces some test improvements to check the calls of different methods on an empty default-constructed container. Apart from that, many other tests are added to extend code coverage. Task-number: QTBUG-91736 Change-Id: Icc1f1342738603c9bed065b2a36c72ea60b48962 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 7d49dc2222ddfd442face88c2243e28f5d26165f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCryptographicHash: don't present the same data over and over againMarc Mutz2021-07-272-3/+85
| | | | | | | | | | | | | | | | | | | Need to decrement 'remaining' (check), but also increment data (meep). Testing is a bit complicated, as most algorithms are just too slow to fit into the 5min QTestLib timeout. Picked the fast ones and Sha512 (which completes here in < 17s, with threads), at least. Amends e12577b56396cca0df05f88f8787706a3a12c82d. [ChangeLog][QtCore][QCryptographicHash] Fixed a bug where presenting more than 4GiB in a single addData() call would calculate the wrong result(). Change-Id: Ic72916ebc33ba087d58225af6d8240e46e41f434 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 35453446a511366e1250858b249e36c80b6ad044) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Keep public include header locations for internal module priJaeyoon Jung2021-07-261-1/+1
| | | | | | | | | | Amends f254d62cb1807d5bd9ee2e23ef64d4ca2d1b6809. Task-number: QTBUG-95303 Change-Id: Ica8d2850fe427b780d62cd9a9528f387a7ea1b79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c89a9ccbccdd7d6ceec669e7effec5786eb3f642) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use namespaced variables in Qt6*Dependencies.cmakeLi Xinwei2021-07-264-96/+95
| | | | | | | Change-Id: I166988020cfd9750a4d58e519742215d0c03ad3e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit bd594f945773f713ca493fd7b040fde8a12bdf87)
* QLocalSocket/Unix: fix aborting the socketAlex Trotsenko2021-07-243-0/+8
| | | | | | | | | | | | | | | | | | | According to the documentation, calling abort() should immediately reset the socket to its initial state. This includes: - closing the file descriptor; - closing the QLocalSocket as an I/O device; - canceling a pending outgoing connection, if it exist; - reseting 'serverName' string. So, adding a call to close() resets the state entirely. Change-Id: I9c604b5187c6300b437d7aa4c2d06db03edacf21 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit d9c0af92bd893e1f6a0b4c627300ea96a73aba55) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QSqlRecord benchmarks non-fatuousEdward Welbourne2021-07-231-2/+6
| | | | | | | | | | | | | | | Because QBENCHMARK re-runs its block repeatedly, to get sensible data, the block needs to actually do something when repeated. Since these tests had blocks that looped while (qry.next()), they left qry at its end state, so such repeats tested nothing. Use seek(0) at the start of each cycle to actually do the work repeatedly when the block is repeated. As a drive-by, split a long line. Task-number: QTBUG-91713 Change-Id: Id46f77dc5e71335871af79ff61e1980b5f636179 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 432eab3bc09bd4c6e6904905fae53f64227a1518) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Halve the data-set size of tst_QSqlRecord::benchmarkRecord()Edward Welbourne2021-07-231-1/+2
| | | | | | | | | | | At 1000, the set-up was taking longer than the five minutes QtTestLib's WatchDog allows, so the test got killed. Task-number: QTBUG-91713 Change-Id: Ia3c85b223fc917ad5817364505cbffe50d67ddc6 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 346bdc6143dfe79a4b02a5fc410a8963b3d0c1f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't slow down a QMap benchmark by growing a megabyte-long stringEdward Welbourne2021-07-231-1/+1
| | | | | | | | | | | | | | | Change a += to simple assignment where it's string arithmetic (a hundred thousand concatenations of "Hello World" add up to more than a megabyte, in an incremental growth that's going to dominate the QMap operations we were meant to be benchmarking) and the only reason for it is to avoid an unused result warning. Accumulating int values is harmless, but strings are another story ! Task-number: QTBUG-91713 Change-Id: Ib0dc131b0cc75fea23998afc0300e8cb60076c7e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 2e24ee02af30821200876bcc0c308ee844155aec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix incorrect default plugin conditions on WindowsAlexandru Croitor2021-07-231-1/+1
| | | | | | | | | | | | | | The correct variable to check is WIN32 rather than WINDOWS. This affects which plugins get automatically linked in a static Qt build. Amends a3b58a7844f77bd416fad8307f8333ff7c0efacf Fixes: QTBUG-95283 Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 91cc4fd6994701c87329de866333eb0bda0e37ef) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use QChar::fromUcs4(i) rather than QChar(i) on out-of-range iEdward Welbourne2021-07-231-16/+28
| | | | | | | | | | | | | | | | | | | | Follow-up to commit 915be6606ead25f4fbbbcb2687b33cf22a955177, catching some benchmarks that took for granted they can assign an arbitrary int to QChar. Since 6.0 this has triggered an assertion. Given the choice between limiting the range (from 100000 to 0x10000) and actually handling the out-of-range values as UCS-4 data, the latter seemed like a more interesting test. At the same time, take the construction of the strings out of the loop, as that's not a QMap performance matter, it's a QString one. Task-number: QTBUG-91713 Change-Id: Id6abab08b5c879f0f764350f66d6aa1dd9f1620a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit b5950f6aff9ca646c55e640dd3d67105f56070e1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>