summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Revert "QString::lastIndexOf: fix off-by-one for zero length matches"Jani Heikkinen2021-08-251-2/+2
| | | | | | | | | | | | 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-182-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* 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>
* 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-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. 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>
* 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>
* QLocalSocket: do not emit aboutToClose() twiceAlex Trotsenko2021-08-012-2/+0
| | | | | | | | | | 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>
* QByteArray: fix indexOf/lastIndexOfIvan Solovev2021-07-291-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | 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-272-0/+8
| | | | | | | | | | | | | | | | | | | 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>
* 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>
* QCryptographicHash: don't present the same data over and over againMarc Mutz2021-07-271-3/+1
| | | | | | | | | | | | | | | | | | | 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>
* QLocalSocket/Unix: fix aborting the socketAlex Trotsenko2021-07-242-0/+2
| | | | | | | | | | | | | | | | | | | 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>
* 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>
* Make QFutureWatcher::isFinished() consistent with the watched QFutureSona Kurazyan2021-07-232-7/+2
| | | | | | | | | | | | | | | | | | | | | | All the getters of QFutureWatcher are consistent with the getters of the corresponding QFuture, except for the isFinished() method, which returns 'true' only after the finished() signal is delivered. This behavior might be unintuitive for the users. In particular, isFinished() returns 'false', even if it's called immediately after waitForFinished(). [ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The QFutureWatcher::isFinished() method now indicates if the related QFuture is finished, instead of indicating if the finished() signal was delivered. This makes it consistent with the future that is being watched. Fixes: QTBUG-91048 Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 53e4a50c6b3c7359b9afc24f30c9517abdf9561a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Sync default action when checking tool button programmaticallyVolker Hilsheimer2021-07-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | QAbstractButton::setChecked is not virtual, so QToolButton cannot override to synchronize the default action's checked state. This resulted in button and default action not being in sync when the checked state of the button was changed programmatically, while changing the checked state on the action kept the button in sync. Connect to the button's own toggled signal instead to keep the state of the default action in sync. Make it a unique connection to allow multiple calls to setDefaultAction, which are used by QToolButton to keep the button updated if properties of the default action change. Add a test that confirms that button and action are synchronized both ways, and that we only get single signal emissions when changing either programmatically. Fixes: QTBUG-95255 Change-Id: I0e027faf1da763ef1878e46e85bfa70073c8bf82 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 188d739400e10fc8571bbf2ec86d5cd338b04a5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSet::erase - extend docsIvan Solovev2021-07-221-0/+5
| | | | | | | | | | | | | | Explicitly specify that calling this method for an empty set or with an invalid iterator results in undefined behavior. On a debug build an assert is triggered in such case, but on a release build it will access the incorect index of an array. Task-number: QTBUG-91736 Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit e5ec09ba868685ab2f943b39732a3cac018fedad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update deprecated NSAccessibility methodVolker Hilsheimer2021-07-211-1/+1
| | | | | | | | | | | | accessibilityEnabledAttribute is replaced with isAccessibilityEnabled. https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc Fixes: QTBUG-95293 Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit fe1085e9aebd3b669a18bd889fc007b1fc1c1e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Scale image with MDI icons using the correction factorVolker Hilsheimer2021-07-201-2/+2
| | | | | | | | | | | | | | | | The buffer might be large than needed and contain a lot of uninitialized pixels. Scaling it down to the requested size is wrong, we need to scale it by the correction factor. Amends e56b8e1e59b6df7c7abd48b163abe6846849eb7a. As a drive-by, make the correction factor helper function static. Fixes: QTBUG-94733 Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5d7a58ea45ed834655220e05012ff17ac235131a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* H2: emit encrypted for at least the first reply, similar to H1Timur Pocheptsov2021-07-201-0/+4
| | | | | | | | Fixes: QTBUG-95277 Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit c23b7886348dc313ccec1a131850a7cce1b429de) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNetworkDiskCache: Fix tracking of size during storeItem()Mårten Nordheim2021-07-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the file already existed we simply removed the old one without adjusting the size. So use the removeFile() function which takes care of that. Additionally, if the current size was non-null we previously increased the size (presumably meant to be temporarily but wasn't) and called expire() which would either: 1. not do anything and return currentCacheSize, if it was not greater than the max size. This would mean that the size of the file would be counted twice. or, 2. discard currentCacheSize, measure the size of the items, and then remove some items if the total size surpassed the max cache size Neither of those branches need us to (temporarily) increase currentCacheSize. It also doesn't attain the (presumed) goal of trying to keep below the max cache size after having added the new item. Fixes: QTBUG-95009 Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit d9f80502f6450f0bc8e6d7ca13e1c912ad485599) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix quadratic performance hit in Q(Multi)Map::insert() with hintEdward Welbourne2021-07-201-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | The insert() overloads that took a const_iterator started by calling std::distance(begin(), pos) - which has a cost linear in how far pos is from begin() - in order to, after detach()ing, obtain an iterator at the same offset from the new begin(), using std::next() - also linear. This leads to quadratic behavior when large numbers of entries are added with constEnd() as the hint, which happened to be tested by tst_bench_qmap. That wasn't running, due to some assertion failures, but once those were fixed the hinted tests timed out after five minutes, where their unhinted peers completed comfortably within a second. Check whether detach() is even needed and bypass the std::distance() / std::next() linear delay when it isn't. This brings the hinted tests down to running faster than their unhinted equivalents. Task-number: QTBUG-91713 Change-Id: I6b705bf8fc34e67aed2ac4b3312a836e105ca2f2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 33c916577389fa6607b0b2f6a78da4a0eb485000) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix qt6_extract_metatypes json file generation ruleAlexandru Croitor2021-07-201-39/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Change the copying of ${CMAKE_CURRENT_BINARY_DIR}/${target}_metatypes.json to ${prefix}/lib/metatypes/${target}_metatypes.json to happen as part of the command generating the file, rather than copying the file as part of a separate custom target or POST_BUILD event. This ensures that the custom commands in qt6_qml_type_registration that use those files as dependencies will cause them to be generated before the qml type registration happens, thus eliminating errors like Error 5 while parsing qtbase/lib/metatypes/qt6quick_metatypes.json: illegal value Fixes: QTBUG-94942 Change-Id: Idddd73786d1a622984965c60ac9b4c3bc2c13ab5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit bcca14a1933de9f188950a9a2d3a450a0772d479) Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Always update the input method when QLineEdit receives focusTang Haixiang2021-07-201-0/+3
| | | | | | | | | | | | | | | | The line edit receiving focus might require different input method capabilities (e.g. be a password edit), so the input method needs to be refreshed when focus is received. This implicitly happens on tab focus when the text is selected or the cursor is moved within an input mask, but neither of those might happen, and for click-focus it never happened. Fixes: QTBUG-86846 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I47c5275d3a9d4d190ebce64269a345431346c17c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d5e8efd8cb02876dc314da0579d33af39ba38495) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix placement of placeholder text in QLineEdits with action iconsVolker Hilsheimer2021-07-192-5/+9
| | | | | | | | | | | | | | | | | | | | | After dc794f7622bc00f7ca50fab65d6965695d6d2972, side widgets only got space if they were not fading out, but the logic was not correctly accounting for side widgets that never fade, such as buttons added via QLineEdit::addAction. Fix this to give visible widgets space, unless they are fading out. That was the intent of the original change. Rename the variable to make its purpose clearer, and reset it at the end of the fade-out animation. Add a much-needed test that relies on private APIs to verify that the effective margins are calculated correctly. Fixes: QTBUG-94824 Change-Id: If2ee6be52be9e4f9be1e91f72f27681ce27def6d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 0e6b31019f01c72ea3af3de31095f8269c7d7f30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS 10.15: Fix focus frame for combo boxesVolker Hilsheimer2021-07-191-0/+2
| | | | | | | | | | | | | | | Amends df316963213e765de5b94469622df48b0c9a9e6e to take care of macOS 10.15 specifically, where the focus ring is a pixel too high and leaves a gap that's visible on high-dpi displays. On macOS 10.14 and before, and for editable comboboxes, the focus frame is correct. Fixes: QTBUG-94069 Change-Id: I278aa30036808c06f8e71385d4797315e46d8f1d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit eaa48136a39f153b05bb1842734bbe2277191510) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add high-resolution pixmaps for macOS dock widget title iconsVolker Hilsheimer2021-07-1922-8/+28
| | | | | | | | | | | | The macOS style falls back to the QCommonStyle for those, and that style loads the macstyle pixmaps. Weird, but cleaning that up is for another commit. Fixes: QTBUG-38776 Change-Id: Ie1fe721387e64cb91ee5fc528667a63e6ddd6eed Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 550e511ec8a1aa12ac75ebd71079511572840065) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: fix separator actions not showing in menusVolker Hilsheimer2021-07-191-14/+9
| | | | | | | | | | | | | | | | | | Amends a3f3af8a8fb8f8b09d1685df5ab836244f850a62, which resulted in the last visible separator always getting hidden. Don't abuse QCocoaMenuItem::visible property to store whether the native NSMenuItem is shown, only store whether it should be shown. Rename the local variables to simplify the logic. Fixes: QTBUG-94802 Change-Id: I56e8c99a2a46d8cbdf75c4ad6cb714961f28a6a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 6832789bbd1a19499bffd05b1cac400db2bdd948) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Remove mentioning of Qt::MidButtonKai Köhne2021-07-191-1/+1
| | | | | | | | | It's only Qt::MiddleButton in Qt 6. Change-Id: Ia68bad910c617993e30e3ed1e117192469ec50eb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 88b92f76ee977a8d0043134451c55cd28c041d8d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix rearranging of icons in listview via drag'n'dropVolker Hilsheimer2021-07-191-0/+2
| | | | | | | | | | | | | | | | | | | | | Since 0f1008a5936c903ca9448193df7df6117e2c617b, views record if they moved the item in the model, and prevent the deletion of the source item in QAbstractItemView by setting the dropEventMoved private data member. However, QListView in icon mode is special: it doesn't rearrange the model, it repositions the icons in the view. While the dropEventMoved logic was applied to the drag event filter to prevent deletion, the variable was never set in the filterDropEvent handler. The drop event got ignored, breaking rearranging of icons. Fix this by setting the dropEventMoved member in filterDropEvent. Fixes: QTBUG-94226 Change-Id: I963f5db0f81bcd0d25eef05d9a265be00a5871f6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 14e09ada69fc3f1b09a8ad8228c3b8ebb542b220) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QListView: don't scroll if selected items are removedVolker Hilsheimer2021-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | For SingleSelection, removing the selected item will select the nearest item and, if autoScroll is enabled, ensures that the newly selected item is visible in the viewport. This may result in scrolling. For Multi- or ExtendedSelection, this should not happen, as having no selection is perfectly fine in those modes. However, QListView still tried to scroll to the current item in response to the currentIndexChanged signal. Since the currentIndex is at this point already hidden, the rectangle for it became invalid, and the attempt to scroll resulted in a one-pixel up-movement of the viewport (since the invalid rectangle has width == height == -1). Fix this by not scrolling if the rect for the index is invalid. Note that the index is still valid at this point, so we can't shortcut the call stack earlier. Add test that exercises the different combinations of ViewMode and SelectionMode, and demonstrates the one-pixel movement without the fix. Fixes: QTBUG-94788 Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 26bebd2037eb69f7c939c899e3238a3e0f0a2376) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Fix unnecessary clipboard data accessMike Achtelik2021-07-161-12/+7
| | | | | | | | | | | | | | Android 12 introduced a notification which is shown to the user each time the app accesses the clipboard via getPrimaryClip. Currently this notification is triggered, even if we just want to check, if some clipboard data exists. So lets not get the actual data and instead use getPrimaryClipDescription to check for the existence of the correct mime type in the clipboard. Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 5a7f4c1f4964a4bf6595002478fbcd474cedd8a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>