summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: blacklist tst_QGraphicsAnchorLayout::layoutDirection()Liang Qi2020-10-221-0/+2
| | | | | | | | | | | | on Ubuntu 20.04 There is some issue with the glib event dispatcher. Task-number: QTBUG-87728 Change-Id: I4d64206898dd2c8356d5fc51a68c2e5759b38aac Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> (cherry picked from commit 88f3f33beba48250ac82c92aac239ba4c1b0cdee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* [Android] Make sure expose events are emitted after window resizePiotr Mikolajczyk2020-10-211-3/+0
| | | | | | | | | | | | | Expose event would not be sent when window was resized Fixes: QTBUG-69155 Change-Id: I81bf2d54f830a0dabf15398e1f25b55ff7ff4479 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Heikki Halmet <heikki.halmet@qt.io> (cherry picked from commit a02ea26b469a32fbdcd9ce777dd46aeacc5cd82f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAbstractItemView: don't lose items if model only allows MoveActionVolker Hilsheimer2020-10-161-19/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a model only allows MoveAction, then calls in the view/widget subclasses' dropEvent implementation to set the event's drop action to CopyAction will fail. QAbstractItemView will then remove the item when QDrag::exec returns. Instead of abusing the event actions for this, store explicitly that the dropEvent implementation already moved the item. If the flag is set, don't remove the item. In QListView, which uses moveRow to move items in the dropEvent handler, handle the case that the model might not implement moveRows. In that case, or when dropping an item onto another item (to overwrite data), fall back to the default implementation of QAbstractItemView. Sadly, it is impossible to know whether a model doesn't implement moveRows, or whether the move failed for other reasons, so this requires a bit of extra special case handling. QListView in IconMode is particularly odd in that it moves the item in the view, but not in the model. This follows up on fd894fd68edf3d67975cda8eb9dda43646887b0d and fixes additional issues discovered during debugging. Extend the existing unit test; since drag'n'drop runs a modal, native event loop on most systems, it still only runs on the Xcb platform. Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4 Fixes: QTBUG-87057 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit 0f1008a5936c903ca9448193df7df6117e2c617b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocalSocket/Win: prevent writing to broken pipeAlex Trotsenko2020-10-151-0/+1
| | | | | | | | | | | | | When a peer closes the connection, the device remains opened for reading purposes. However, we should disable writing on disconnected socket. Otherwise, if the user issues a write() call, a new pipe writer object will be created and the write call occurs with invalid handle value. Change-Id: Id136798c7663df1fce7ed0aa4e3c6f5c65218a11 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 53b4556332e95820622742e9be16281a77f9d337) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add QStringView::split()Lars Knoll2020-10-151-0/+5
| | | | | | | | | | The implementation has to live in qstringlist.h and qregularexpression.h, as those classes are only forward declared in qstring.h. Task-number: QTBUG-86516 Change-Id: Ia9b3ff48999d1c2e7df905191ee192764b309d08 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tests: blacklist two tests on Ubuntu 20.04Liang Qi2020-10-142-0/+4
| | | | | | | | | | | | | tst_QApplication::sendEventsOnProcessEvents() and tst_QItemDelegate::editorKeyPress() There is some issue with the glib event dispatcher. Task-number: QTBUG-87137 Change-Id: I79a983192edef3c3560a4296cc9dea2dfc2ee1b0 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> (cherry picked from commit 844318f54aa3f8509c16941727cdc755cbea7f05) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fallback to using the family when doing an exact matchAndy Shaw2020-10-131-0/+15
| | | | | | | | | | | If the difference between the families sizes is just 1 where one of them is 0 in size then we can fallback to the family in that case. Fixes: QTBUG-87267 Change-Id: I62b25b06c88000b4d7defe91871c07873b1fc792 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit bdc9d272eebff66827b566b1b24b6697c797807a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Deal with {und,ov}erflow issues in QLine's length handlingEdward Welbourne2020-10-091-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use std::hypot() instead of sqrt() of a sum of squares. This ensures length() can't be zero when isNull() is false. Use length() in QLine::setLength() rather than duplicating that. Clarify and expand some documentation; isNull() never said what constituted validity, nor did unitVector() mention that is should not be used on a line for which isNull() is true. Make clear that lines of denormal length cannot be rescaled accurately. Given that we use fuzzy comparison to determine equality of end-points, isNull() can be false for a line with displacements less than sqrt(numeric_limits<qreal>::denorm_min()) between the coordinates of its end-points (as long as these are not much bigger); squaring these would give zero, hence a zero length, where using hypot() avoids the underflow and gives a non-zero length. Having a zero length for a line with isNull() false would lead to problems in setLength(), which uses an isNull() pre-test, protecting a call to unitVector(). (It was already possible for a null line to have non-zero length; this now arises in more cases.) Tweaked QLine::setLength() to allow for the possibility that the unit vector it computes as transient may not have length exactly one. Add tests against {ov,und}erflow and divide-by-zero problems in QLine. This fixes two oss-fuzz issues: oss-fuzz-24561 and oss-fuzz-25178. Change-Id: I7b71d66b872ccc08a64e941acd36b45b0ea15fab Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> (cherry picked from commit 1c591fd9246ca776304a3c370dd2578bd886feac) Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* tst_QTcpSocket::connectToHostError - increase the timeoutTimur Pocheptsov2020-10-081-4/+5
| | | | | | | | | | | | As suggested by the message from QTestLib. This, indeed, fixed the sadistic test. Also, make sure resources are not leaked. Fixes: QTBUG-87009 Change-Id: Id693a5a562ea5ebacc853e5fc0ab9654ba851e72 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit cd6d53610ae9a4d075e8575235ce3c8bd893cf2a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blacklist tst_QUdpSocket::writeDatagramToNonExistingPeerHeikki Halmet2020-10-081-4/+2
| | | | | | | | | | | | | tst_QUdpSocket::writeDatagramToNonExistingPeer is also failing with MinGW Task-number: QTBUG-74542 Task-number: QTBUG-80328 Change-Id: I44b886a1fc1eac34deefc34690c6701063a49d8f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit cf0f1e08600edd508969d0f76c9dee49d469b7b3) Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* QUrl::fromLocalFile: accept invalid hostnamesThiago Macieira2020-10-081-0/+15
| | | | | | | | | | | | | | | | | | | | QUrl hostnames must be compliant with STD3, but we must somehow accept file paths that begin with double slash but aren't valid hostnames. Because the file URI spec requires us to start with "file://" anyway, we can represent those with four slashes. Note that on Unix "//X/y" is a valid but local file path. If given to QUrl::fromLocalFile(), if the path at the root does parse as a hostname, we will still try to normalize (the above becomes "file://x/y"). [ChangeLog][QtCore][QUrl] Changed QUrl::fromLocalFile() to accept Windows UNC paths whose hostname component is not a valid Internet hostname. This makes QUrl able to accept extended-length paths (\\?\), device namespace (\\.\), WSL (\\wsl$), etc. Fixes: QTBUG-86277 Change-Id: I3eb349b832c14610895efffd1635759348214a3b Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 97de53ee8cce3dc6347b08668f0de45e1000f01c)
* tst_QUrl/Win: test QUrl::fromLocalFile with backslashesThiago Macieira2020-10-081-6/+17
| | | | | | Change-Id: I3eb349b832c14610895efffd1635752ccc82889a Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit dfa35ee6c8c919ccf1ae378074cf1b5501c24d9e)
* tst_QUrl: give the to/fromLocalFile test rows proper namesThiago Macieira2020-10-081-52/+60
| | | | | | | | No change in testing, juts changed names and order. Change-Id: I3eb349b832c14610895efffd16357498454bcd52 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 4e0028895793f656488431179a4ee9c4f61f05fa)
* End touch->mouse synthesis when the chosen touchpoint is releasedShawn Rutledge2020-10-061-0/+24
| | | | | | | | | | | | | | | | | During delivery of a TouchBegin event, if no widget accepts it, we begin treating the first touchpoint as a synth-mouse, as before. If a second touchpoint is pressed or released in any order, it's irrelevant: the fake mouse button is released as soon as the first touchpoint is released. This fixes the bug that such a scenario caused the mouse release not to be sent, so that a widget could get "stuck" in pressed state. Done-with: Tang Haixiang <tanghaixiang@uniontech.com> Fixes: QTBUG-86253 Change-Id: I7fbbe120539d8ded8ef5e7cf712a27bd69391e02 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f51e6552e361c0716f6301b4c5b03b12e8bfe0fe) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTreeView: fetch as many nested entries as fit into the viewVolker Hilsheimer2020-10-021-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractItemModel::canFetchMore and fetchMore implementations might only add a few rows to the model each time they are called. The item views don't generally expect that, and don't call fetchMore repeatedly, even if there would be room in the itemview for more data. This problem cannot be generally solved for all item views, as it would require in repeated expensive laying out of items. For nested indexes in a treeview however, we can try to fetch enough child rows to populate the screen when the item is laid out by repeatedly calling canFetchMore and fetchMore. To calculate how many items have space, apply the same heuristics as in the scrollContentsBy implementation to guess the number of items that can fit into the viewport. Created test case for the fix. Done-with: Doris Verria <doris.verria@qt.io> Fixes: QTBUG-85366 Change-Id: I54f95552993873dd4cba80b0f70f4db9d98ddc1d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit e74af68654c0eb127277c73e20bda409b83d157b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix race condition in QThreadPool::clearAllan Sandfeld Jensen2020-10-011-0/+26
| | | | | | | | | | | | Since we drop the lock while deleting threads, we need to handle the queue possibly being accessed and changed by the pool threads while clear() is running. Fixes: QTBUG-87092 Change-Id: I7611edab90520454278502a58621e299f9cd1f6e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit fe36d47b371b71ad5fec30d4b5d7bf0baa0205ea) Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Revert "Blacklist tst_QWindow::exposeEventOnShrink_QTBUG54040"Liang Qi2020-10-011-1/+0
| | | | | | | | | | | | This reverts commit b1ef104866f78ae5bbc1214ae524bad4120ef0e2. This test is BPASS on openSUSE_42_3 for 5.12 and PASS on openSUSE_15_1 for 5.15. Change-Id: Ia1d81ed38491c27c01f270623c5082663f4da699 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> (cherry picked from commit be7d46f5e2b8b4109bcb1ef1f5e765e87354aa9b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Properly deprecate QProcess::pidVolker Hilsheimer2020-10-012-2/+2
| | | | | | | | | | | | Address an old ### Qt 5 comment. The method has been documented as deprecated and replaced by QProcess::processId since at least Qt 5.9, so we can first properly flag it as such for 5.15.2, and remove it from Qt 6 in a follow-up commit. Change-Id: Ic4e3351740617083b16723db8eef7a341bccfbf6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3fb8f9e44e8cbf5937257505d0bc2d1457a26da1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tests/xcb: fix tst_QWidget::updateWhileMinimized() - againLiang Qi2020-09-301-1/+2
| | | | | | | | | | | | | This amends 4403ec3bc1501cde454b0546759d4c27f9b6cb1b. CentOS 8.1 uses GNOME in XDG_CURRENT_DESKTOP. Task-number: QTBUG-68862 Change-Id: Ia9a6f7f4c47853fc53d9860dad070109271a438e Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> (cherry picked from commit b05e444a923e8362b6912da6dcda8247f7233322) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QJsonObject: fix sorting after parsing from JSON textThiago Macieira2020-09-301-8/+43
| | | | | | | | | | | | The logic was complex and missed the UTF-8 UTF-8 case. It ended up calling the UTF-8 to Latin1, resulting in an improperly-sorted container, which in turn meant keys were not found when searched. Fixes: QTBUG-86873 Change-Id: I0d3ff441bec041728945fffd16379dec418637ca Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f00d322f6701580f97f38794b83b0ec13973d177) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't error out when configuring Qt on a headless systemVolker Hilsheimer2020-09-261-4/+5
| | | | | | | | | | | | | | | | Configuring and building Qt should not require a running dbus session bus. However, when building the html_docs target on a headless system, qmake bails out with error if dbus is linked in, while only showing a warning if it's not. This is unnecessary. We can warn in both cases, build the tests with dbus linked in. Running the tests will fail if there is no session bus, ie. tst_QDBusConnection_Delayed::delayedMessages fails with QVERIFY(session.isConnected); (adapted from d26fe3c5d6d73b0663a33d2f25ed053cc1f70d5e) Change-Id: Ia6b6e226398e87880449b003d28dfd76553bee2c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* fix QComboBox currentText return placeholderTextWang ChunLin2020-09-251-1/+1
| | | | | | | | | | If it does not add item,the currentText should return empty string Fixes: QTBUG-86580 Change-Id: I54c3a8b7ececfb1e62bcd7ac592feccaff3f8b48 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 789d487cb0f4ef6f9d3e7c6ab5c5283dfe8dd350) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMimeDatabase: fix handling of glob-deleteallDavid Faure2020-09-231-2/+7
| | | | | | | | | | | | | | | | | Binary provider: It was not possible to remove the first glob in a local override, because the mainPattern handling would re-add the first glob back. XML provider: It didn't support glob-deleteall. Also, the order of the providers was wrong. We want to pick local overrides first, the internal DB has to go last in the list. Fixes: QTBUG-85436 Change-Id: I9a4523f37cd962c730df9a6ed992bd01c075bf03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit fc8f5afc874073f91d3770273e0a9164182d7897) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add reentrancy guard for processEvents() in QProgressDialog::setValue()Christian Heimlich2020-09-221-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of QProgressDialog always calls QCoreApplication::processEvents() when the user calls QProgressDialog::setValue() if the PD is modal. For most cases this is fine, but when using a Qt::WindowModal PD with setValue() connected to a signal in another thread using Qt::QueuedConnection a reentrancy issue is present if setValue() is triggered too frequently as the execution of its previous call may not have finished. If this happens too many times in a row a stack overflow will occur. Current documentation notes this potential issue but offers no way it avoid it while still using QProgressDialog (user must implement a custom dialog) without resorting to using Qt::BlockingQueuedConnection, which unnecessarily reduces performance. Introduces the boolean reentrancy guard "processingEvents" that is checked before calling QCoreApplication::processEvents() in a modal PD when setValue() is used. It is set before the first call to processEvents() and cleared after that call returns. This ensures that only one invocation of processEvents() is possible from within setValue() at a time, and thereby minimizes iterations of the main event loop and eliminates the aforementioned stack overflow condition. See - https://forum.qt.io/topic/118292/ Fixes: QTBUG-10561 Change-Id: Ifa9b91cbb66881981356954ead0906bdc91fab60 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> (cherry picked from commit 10bc093d4fa1889b7a5f6151c9bcc79aa31ecfc5) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStyleSheetStyle: Fix push button hit testing with paddingVolker Hilsheimer2020-09-151-2/+8
| | | | | | | | | | | | | | Amends f9940b15f7f0fde731431626172939b9821fd660, which amended 6e1d70ae12baae4610356ec7b69635ad75a97b4e. The bevel of the button is not defined by the contentsRect, but by the borderRect that the stylesheet style calculates. Change-Id: I9a0d5bf29a06ce2270014f0d144e33cc3a1a7473 Fixes: QTBUG-86587 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 757a9c21c18faad5573308d8dd85428a4519ac7d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Schannel: Properly handle request for certificateMårten Nordheim2020-09-141-8/+0
| | | | | | | | | | | | | | | Certain servers, like smtp.live.com, will send a request for a certificate even though they don't require one. In Schannel this manifests as a warning/info status (SEC_I_INCOMPLETE_CREDENTIALS). In the cases where it's not needed we should suppress the warning and try to connect anyway, which is done by calling InitializeSecurityContext again when we get the status. Change-Id: I3c48140f2949d8557251a49a2b66946da9395736 Reviewed-by: Joshua GPBeta <studiocghibli@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 2253d5eca6de707080af9af11bc0dcfdea846fc5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSsl: workaround a 'very secure' OpenSSL version (CentOS 8.x et al)Timur Pocheptsov2020-09-144-1/+32
| | | | | | | | | | | | | | CentOS it seems not only backported some OpenSSL 3 functions, but also raised the default security level to 2, making some of our keys (and MDs?) 'too weak' and failing auto-tests here and there as a result. For our auto-test we lower the level to 1, as it is expected to be. Fixes: QTBUG-86336 Change-Id: I7062a1b292e8b60eb9c2b2e82bd002f09f9da603 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 605d2163f1dcd7e1ad701ade913cb476b91865b1) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Interbase: Handle EXECUTE BLOCK statements correctlyAndy Shaw2020-09-131-0/+22
| | | | | | | | | | | | | Since an EXECUTE BLOCK statement can have a mix of ? and :var syntax then a special case for this needs to be added so that it does not try to convert the :var parts into positional placeholders as they need to kept as-is when preparing such a statement. Fixes: QTBUG-83152 Change-Id: Iff891207ad6dea1681a1b3a335acbbbb668b465d Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 65afcef2173cabe297778d19dda3198595820cfa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QNetworkReply: Avoid race in ioGetFromHttpWithAuthMårten Nordheim2020-09-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | Our authentication code is race-y by design: 1. When two requests are fired off and queued at the same time in the same QHttpNetworkConnection then if one of them encounters "authentication required" then it will copy whatever credentials it got to all the other channels in the connection. This is likely what the first part of the test is testing. 2. If a later request is fired off and it includes credentials in the url then the newly included credentials should be used instead of the cached ones. The race here can occurr when one socket either takes too long to connect or the connected signal is not received early enough. Then the first socket is used for both requests and then we can hit case #2 when the url contains credentials. Change-Id: I646a5378d8c1256b2de98b51912953df29f68cb2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 5a47939d5c07a968f27562a3ebc800fcc2b225bc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator: condition using GSSAPI on credentials availabilityMårten Nordheim2020-09-121-3/+3
| | | | | | | | | | | | AFAICT with GSSAPI the normal workflow is to run kinit or similar and authenticate before running programs relying on it. Therefore we can try to get the credentials before we choose whether or not to use Negotiate. Task-number: QTBUG-85123 Change-Id: If0478fdd45389b2939ad87c2f582776fe56959bb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit e0918af700acefd6e80562c051e42d0b64097e1f)
* Fix a rather sloppy test case in tst_QSslKeyTimur Pocheptsov2020-09-111-6/+52
| | | | | | | | | | | | | It's not guaranteed that all curves we want to use are supported by a specific build of OpenSSL library we have to link with. Filter out files that contain EC, which is not among the curves, reported by QSslConfiguration::supportedEllipticCurves. Fixes: QTBUG-46203 Change-Id: I70d7e6fcacb3d81f8c771e4a8d6cca06295e7474 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 4f658d04da03953358959c0a0921e564cf67ecb2) Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Blacklist tst_qcolumnview::scrollTo on macOSUlf Hermann2020-09-091-0/+3
| | | | | | | | | | It flaky fails for both normal and reverse cases. Task-number: QTBUG-41341 Change-Id: If6ecd6dc58f131bb67d46a5d508f59b6bb0fd962 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 7a2f12974872a3f1981cce2e18936f1dd127fa8a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSqlite: Don't crash after binding too many placeholdersMarcel Krems2020-09-091-0/+10
| | | | | | | | | | | | | | When you bind more values than the query has placeholders, indexes will be empty which causes an out-of-bounds access in indexes.first. We can't check the parameter count because of multiple placeholders with the same name, so we check if the name is null. Tested with SQLite and PostgreSQL Change-Id: Id5d4bd15d7ed16603f47b87d6e0bf811a20157d8 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 41a716ebbfc9a8fcbf8ebca24da9638d3e9b9639)
* Interbase: Correctly read/write arrays to the databaseAndy Shaw2020-09-081-0/+29
| | | | | | | | | | | | The fix ensures that it can find the column for the array correctly when reading/writing and also handles the integer typed arrays correctly too. Fixes: QTBUG-83409 Change-Id: I92d982bdf0927e6ebc6dce84fec9ad6c44c26c25 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 13fe0ab5de63871cdacd41a68608b97b29edb89d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTable/TreeView: fix sortByColumn() when view is already sortedChristian Ehrlicher2020-09-022-0/+69
| | | | | | | | | | | | | | When the view was already sorted by the column and order given to sortByColumn(), a resort was not triggered which is a regression since d0f909f8dbdd8594b0d950822f0e7ab8728da513. Therefore don't rely on sortIndicatorChanged() in this case and trigger an explicit sort as it's done when no user-triggered sorting is enabled Fixes: QTBUG-86268 Change-Id: I3ec30ab81f304d5a19cef6d67b8a81c21b4a112d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 3ddffd2d8b619863930854705ca5577c0389d65f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Mark some Qt namespace enum members properly as deprecatedEdward Welbourne2020-08-281-1/+0
| | | | | | | | | | | | | | | | A comment is not good enough, Some of the enum members were even still in use, or mentioned in documentation. WA_ContentsPropagated, WA_WState_DND and WA_ForceAcceptDrops have been deprecated since 4.5.1; and at least the last has been an \omitvalue in the docs for even longer. (WA_ShowModal and WA_GroupLeader have been similarly marked, but are in use, see QTBUG-85816.) Push back to 5.15.1 in order to be able to remove these at Qt 6. Change-Id: I6ea3839767e5f5158b0fed508f65798470191908 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 7883bf730405b20594dd1385b8e817160a5895f2)
* QStandardPaths/Unix: improve the XDG_RUNTIME_DIR creation/detectionThiago Macieira2020-08-272-59/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, use QT_MKDIR instead of QFileSystemEngine::createDirectory(), as the latter can't create a directory with the right permissions. That would allow an attacker to briefly obtain access to the runtime dir between the mkdir() and chmod() system calls. Second, make sure that if the target already exists that it is a directory and not a symlink (even to a directory). If it is a symlink that belongs to another user, it can be changed to point to another place, which we won't like. And as a bonus, we're printing more information to the user in case something went wrong. Sample outputs: QStandardPaths: runtime directory '/root' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0 QStandardPaths: runtime directory '/dev/null' is not a directory, but a character device, socket or FIFO permissions 0666 owned by UID 0 GID 0 QStandardPaths: runtime directory '/etc/passwd' is not a directory, but a regular file permissions 0644 owned by UID 0 GID 0 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-tjmaciei' QStandardPaths: runtime directory '/tmp/runtime-tjmaciei' is not a directory, but a symbolic link to a directory permissions 0755 owned by UID 1000 GID 100 Change-Id: Iea47e0f8fc8b40378df7fffd16248b663794c613 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit ad5a65b6a2bfca1658634e380559d14ea1e904a4) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Synchronize QEventDispatcherWin32::processEvents() with QCoreApplicationAlex Trotsenko2020-08-261-0/+26
| | | | | | | | | | | | | | | | QCoreApplication has a special internal mechanism to control whether the event dispatcher should block after delivering the posted events. To handle queued connections in nested loops properly, we should use that functionality. Fixes: QTBUG-85981 Change-Id: I124179a23b26a995cf95ed379e97bfa62c95f42a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit fe4b246446f721085946e399b96a42eccfcecca8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Un-deprecate QByteArray's relational operators taking QStringSona Kurazyan2020-08-261-2/+0
| | | | | | | | | | | | QString still has the overloads of relational operators taking QByteArray. Un-deprecate QByteArray's relational operators taking QString for symmetry. See also the comments of d7ccd8cb4565c8643b158891c9de3187c1586dc9 for more details. Change-Id: If3f59376b389fe4cbc2bd649a748bb78378a530c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d8ee1f6385b4dfeb57cb466b6c5f6bcfd3a90dfb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QRegularExpression: do not assume QStringViews are NUL terminatedGiuseppe D'Angelo2020-08-261-0/+31
| | | | | | | | | | | | The convenience API used to look up the index of a named capturing group expects NUL terminated strings. Therefore, we can't just use it together with QStringViews, which may be not. Use the non-convenience API instead. Change-Id: I25ca14de49b13ee1764525f8b19f2550c30c1afa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 049d8892eaa18d71d6edb10752418ad33305f310) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix CaseSensitivity handling for QRegularExpression in QSortFilterProxyModelMarcel Krems2020-08-241-0/+21
| | | | | | | | | | | | setFilterRegExp retains the caseSensitivity() while setFilterRegularExpression did not. Change setFilterRegularExpression to also retain the case sensitivity. Also fix the inverted logic in setFilterCaseSensitivity. Fixes: QTBUG-83313 Change-Id: I46f494d320aee99d50612f01f63558c693276989 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 9a921d78e87452962043721669f3027f7566eef4)
* tst_QLocalSocket: fix wrong slot nameAlex Trotsenko2020-08-241-1/+1
| | | | | | | | | | | Suppress the warning: QObject::connect: No such slot LocalSocket::slotError(QLocalSocket ... Change-Id: Ia08505ebc85d4070582c7ddaae8b581d394dbb80 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b3310426b6ae09fd9aba4183e60c7b88b837e735) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Properly deprecate Qt::MidButton in favor of Qt::MiddleButtonEdward Welbourne2020-08-223-17/+17
| | | | | | | | | | | | | MidButton had its // ### Qt 5: remove me upgraded to Qt 6 at 5.0; but it dates back to 4.7.0 Replace the many remaining uses of MidButton with MiddleButton in the process. Change-Id: Idc1b1b1816673dfdb344d703d101febc823a76ff Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 16e546e32fec393bc3b126f280114bcbfa7151ff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Discard extra mouse move event generated by touchpadAndre de la Rocha2020-08-181-0/+1
| | | | | | | | | | | | | | | | | | | On Windows, and possibly other platforms, a touchpad can send a mouse button press followed by an unexpected mouse move event to the same coordinates, before sending a mouse button release, which may confuse applications. Before the enhanced mouse event processing was added, the code in QGuiApplication was responsible for deducing the mouse event type and other info, and in the process performed a checking that discarded events that did not change state. The enhanced mouse processing code lacked this checking. This change adds an equivalent checking to the enhanced mouse event processing. Fixes: QTBUG-85431 Change-Id: Ie3e2ae8cbf9870d465dfd2c8808942dd6fc647d2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit b50daef9771d8829fc7f808898cbe051a5464b79) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add binary compatibility files for Qt 5.15.0 for QtBaseMilla Pohjanheimo2020-08-1711-0/+105972
| | | | | | | Binary compatibility files added. Change-Id: I36167c7ac98182fe3cbd7fcadf0ca6c4d8d9723c Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Fix conversions to JSON from QVariantSona Kurazyan2020-08-141-0/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After reimplementing Qt JSON support on top of CBOR, there were unintended behavior changes when converting QVariant{, List, Map} to QJson{Value, Array, List} due to reusing the code for converting QVariant* types to CBOR types, and from CBOR types to corresponding JSON types. In particular, conversions from QVariant containing QByteArray to JSON has been affected: according to RFC 7049, when converting from CBOR to JSON, raw byte array data must be encoded in base64url when converting to a JSON string. As a result QVariant* types containing QByteArray data ended up base64url-encoded when converted to JSON, instead of converting using QString::fromUtf8() as before. There were also differences when converting QRegularExpression. Reverted the behavior changes by adding a flag to internal methods for converting CBOR to JSON, to distinguish whether the conversion is done from QVariant* or CBOR types. These methods now will fall back to the old behavior, if the conversion is done using QJson*::fromVariant*(). Additionally fixed QJsonValue::fromVariant conversion for NaN and infinities: they should always convert to QJsonValue::Null. This works correctly when converting from variant to QJsonArray/QJsonObject, but has been wrong for QJsonValue. Added more tests to verify the expected behavior. [ChangeLog][Important Behavior Changes] Restored pre-5.15.0 behavior when converting from QVariant* to QJson* types. Unforeseen consequences of changes in 5.15.0 caused QByteArray data to be base64url-encoded; the handling of QRegularExpression was also unintentionally changed. These conversions are now reverted to the prior behavior. Additionally fixed QJsonValue::fromVariant conversions for NaN and infinities: they should always convert to QJsonValue::Null. Fixes: QTBUG-84739 Change-Id: Iaee667d00e5363906eedbb67948b7b39c9d0bc78 (cherry picked from commit 1df02b5f980b01a4e42f32061f1cba696b6a22e9) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QJsonDocument: fix comparison of valid vs defaultThiago Macieira2020-08-121-0/+61
| | | | | | | | | | | | [ChangeLog][QtCore][QJsonDocument] Fixed a bug that caused QJsonDocument's equality operator to crash if one of the operands was default-constructed and the other wasn't. Fixes: QTBUG-85969 Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit e790af0e0a030dea597bbc9489170b5ba1cf9e46) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSharedPointer: do allow calling deleters on null pointersThiago Macieira2020-07-311-2/+31
| | | | | | | | | | | | | | I don't know why std::shared_ptr allows this, but why not. [ChangeLog][Important Behavior Changes] QSharedPointer objects will now call custom deleters even when the pointer being tracked was null. This behavior is the same as std::shared_ptr. Fixes: QTBUG-85285 Change-Id: I24006db8360041f598c5fffd161c260df0313b55 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 95afe6b244dbd9623a92399d1bed0b9f52aa1e65) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNAM: Remove network connectivity pre-checkMårten Nordheim2020-07-301-9/+0
| | | | | | | | | | | | | | | | | | | | The connectivity pre-check has been around for a long time, and it has caused various issues in that time. Certain scenarios, like using certain VPN configurations, might confuse the OS into thinking you don't have and network connectivity at all and abort the connection. Especially noticeable/frustrating when the connection was going to a host inside the local network. The negative impact of this change would at worst be that we might try to connect and it will wait some amount of time before the OS tells us the connection failed in situations where it would previously have been aborted before it started. But the false-negatives are not really an OK sacrifice in that case. Fixes: QTBUG-84907 Change-Id: I37fc69051e39df3c1a1fecb56ef54521a4d3d0c3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a0bfa4e1f8e223927cbb285bb17d1a00a5c2d4b6)
* Make qfloat16 helper functions consistent with float/double versionsAllan Sandfeld Jensen2020-07-281-1/+1
| | | | | | | | | | | Infinite is only when the mantissa is 0, everything else is NaN. std::isnormal returns false on zero. Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d782df48612a932f03a579c889670d34c26e9574) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>