aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix scroll bars not showing up when binding to standalone contentItemMitch Curtis2022-09-021-0/+47
| | | | | | | | | | | | | | | | | | | 908aa77d16e00f2bccc0ddae0f8b61955c56a6a1 hid old scroll bars, but didn't account for the situation where the old scroll bars would be put back into place, and so they never showed up. In the case of the linked bug report, since there was a binding to the ScrollView's contentItem, a default Flickable would be created. After that binding was evaluated, the contentItem was set, causing the scroll bars to be hidden (as part of the process of disconnecting from the old flickable). To fix the issue, we now do the reverse of hideOldItem when a new contentItem is set. Fixes: QTBUG-104983 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Nate Graham (cherry picked from commit 58bae53237417f28eac6d772fa6ecab657f8a73f) Change-Id: I0d5d04cf9268e03b99c8b8fba2eee407e225ae56
* Take over touch grab after initial delayed mouse press from FlickableShawn Rutledge2022-06-131-0/+35
| | | | | | | | | | | | | | | | | | | | | It has always caused a lot of trouble that Flickable only knows how to replay mouse events, not touch events, when pressDelay is set. Only the press is delayed; then if some recipient grabs (e.g. by accepting the mouse event), it grabs the underlying touch point ID, and thus the following touch moves and release will be sent to it as QTouchEvents. So, delegates in itemviews receive touch presses as mouse events, and then touch events; and perhaps it's risky to assume that's all the same sequence just because pressWasTouch got set to true, but now we do it under either of two conditions: touch release occurs near the mouse press, or the touch has been dragged past the drag threshold. (The real fix is in Qt 6: Flickable knows how to replay touch events.) Amends and extends 025f938c1b4676782674d54375e1e4e560e4b6cd and fcc3d346c8aaff74b0054974040d3c1250301563 Task-number: QTBUG-77202 Fixes: QTBUG-104009 Change-Id: I7e1980e2fbc9b7a1b53c56409fb8a7adc424d61c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* DialogButtonBox: fix buttons going outside box on size changeMitch Curtis2022-04-281-1/+83
| | | | | | | | | | | | | | This was removed in c2fd8f7d00e2a47724765e289b828c36c98da29c, but seems to be necessary now. A horizontal ListView's implicitWidth is 0, so setting it to contentWidth seems reasonable regardless. For more history, see 8b78d9cea3091b0bd94d1ae0c71a000f8e7e1903. Fixes: QTBUG-102558 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 2ae87dcece1915797de8065048817707c8f4d24f) Change-Id: I3d67bcd5dbc0297620847f27363acce43a5dc862 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Control in pressDelay Flickable: detect touch release near press posShawn Rutledge2022-04-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | When a control is on a Flickable with a pressDelay, any press event from a touch device will be replayed as a mouse event due to the delay; so it was known already that we cannot depend on the fact that we got the first press as a touch event when checking whether the id matches before accepting it. So we keep the previous pos when it is a synthesized mouse event, so that we can ensure the release is also accepted. That was in place already; but now we no longer require that the release position is identical to the press position: staying within a distance less than the drag threshold is also ok. Some touchscreens are too sensitive, some users have shaky hands, so a "tap" gesture may come with some gratuitous TouchMove events in between the press and the release. Amends 025f938c1b4676782674d54375e1e4e560e4b6cd Fixes: QTBUG-102036 Fixes: QTBUG-102037 Task-number: QTBUG-77202 Change-Id: Ic48b0cca2b1c05b36429925f219d75b1b0085f69 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Reset provider's texture if QQuickNiniPatchImage's source is invalidSukyoung Oh2022-03-291-0/+56
| | | | | | | | | | | | | | When QQuickNinePatchImage is used as a source of other shader related object like ShaderEffect, OpacityMask or etc., there isn't a implementation to invalidate the provider's texture when QQuickNinePatchImage is invalid. It causes segmentation fault due to dangling pointer. Fixes: QTBUG-100508 Change-Id: I9ea25fe68b41d3b15503e3dccea3a816ad485a20 (cherry picked from commit 81bbd0b45aeb1eb98efd9153c79ebf4f0e4be839) Reviewed-by: <sukyoung.oh@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SwipeView: don't cull every child item that gets addedShawn Rutledge2022-02-081-0/+63
| | | | | | | | | | | | | | | | | | This reverts commit a055629f43cf8589ff6d69e46b2610429aaa4167. A SwipeView is a ListView, which means as long as the side-by-side delegates are the right size, only one of them should occupy the area of the SwipeView itself. The other delegates (isCurrentItem == false) are to the sides, and might be outside the window, hidden under other items, or clipped. So hopefully there are not users who rely on this culling to hide them. Fixes: QTBUG-99547 Task-number: QTBUG-51078 Task-number: QTBUG-51669 Change-Id: Ic90dc1c44b9a36dc717238b47003b4d88e91f789 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit e10de033f4c44855de7287a97e2aa651f648742e) Reviewed-by: Seokha Ko <seokha.ko@qt.io>
* QQuickAction: don't grab the same shortcut multiple timesOliver Eftevaag2022-01-201-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | If the entry for the QQuickItem that the QQuickAction is set on has already grabbed the shortcut, then m_shortcutId is no longer 0 and we must not overwrite the value. Otherwise, the QQuickItem removing itself from the action might not remove the correct entry from Qt's shortcut map, leaving a dangling pointer behind. Multiple calls to QQuickActionPrivate::ShortcutEntry::grab are possible, because we grab the shortcut whenever the shortcut changes, or when an item representing the action becomes visible. The test case added reproduces this scenario by adding the action to a menu item and then making the menu explicitly visible, resulting in two calls to grab() which should be idempotent. Fixes: QTBUG-96551 Fixes: QTBUG-96561 Change-Id: I7d42a4f4c04f7d8759f2d0f24a133720f10e4c47 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQuickAbstractButton: fix crash on destructionUlf Hermann2022-01-191-0/+23
| | | | | | | | | | | | If we listen for size changes we also need to remove the object listened to when it's deleted. (adapted from commit 720ffaeb60d43123522066e1de3a69ad551644aa in qtdeclarative) Fixes: QTBUG-99644 Change-Id: I9dc6ecc3636ee14f792dca8fa2d4bb5b3cdb3fa9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* AbstractButton: fix fast clicks being treated as double clicksMitch Curtis2022-01-041-0/+49
| | | | | | | | | | | | | Only emit the doubleClicked signal if it's connected to something. While we're at it, optimize isPressAndHoldConnected() by making locals static. Fixes: QTBUG-96888 Change-Id: I7b737d5ab75240bd06cc7f9daad7d848b8278d49 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 220a547aa440019ebcb1dd411ed95ecbf197e0f1) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* RangeSlider: update handle positions when 'from' or 'to' value is changedIvan Solovev2021-12-031-0/+37
| | | | | | | | | | | | | | The RangeSlider's setTo() and setFrom() implementation was not updating the positions of the handles. This patch fixes it and aligns the behavior with the basic Slider. This commit is cherry-picked from qtdeclarative repo of the dev branch, because QuickControls2 were merged into that repo in Qt 6. Fixes: QTBUG-98482 Change-Id: I482c416f91be2b97af1d922305dfe6fc1f5bd573 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 7ff266ff782b35817d3ecc1a08c3a54bd2c2aa88)
* Consider all popups in the stack to test whether an event should be blockedVolker Hilsheimer2021-10-182-0/+139
| | | | | | | | | | | | | | | | | Since modal and modeless popups can be arbitrarily nested, it's not enough to just let the first popup in the stack handle an input event to see if it should be blocked. The first popup might be modeless and have a modal parent that then should block events to items further down. So, return true for the first popup that handled the event, otherwise continue down the stack. Fixes: QTBUG-86854 Change-Id: I04fe7833b86353f40cb047cd1330751233dc98c3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 85be957e9f936ea2d0fd9d7ceaf5da8eb1bcac49) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Give focus to popup on prepareEnter instead of finalizeEnterTomi Korpipaa2021-10-152-0/+98
| | | | | | | | | | | | | | If focus is given on finalize, then popups that have enter transitions may end up stealing focus from popups that were opened later. Note: Qt 6.x needs a separate task, as qtquickcontrols2 is inside qtdeclarative. Otherwise the commits are identical. Dev version can be found here: https://codereview.qt-project.org/c/qt/qtdeclarative/+/376858 Fixes: QTBUG-85918 Change-Id: If58b4278edeea8673e56c25d899cd4e3c4765edc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix activeFocus for highest-z popupTomi Korpipaa2021-10-152-0/+129
| | | | | | | | | | | | If there was no popup with active focus, giving focus to the highest-z popup failed on exiting the previous one. This is identical to the dev version, only in a different module: https://codereview.qt-project.org/c/qt/qtdeclarative/+/376653 Fixes: QTBUG-85956 Change-Id: I6f328abfd2d6379297b97940420789aa80293977 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Blacklist some flaky tst_qquickpopup functions on openSUSEMitch Curtis2021-09-211-0/+8
| | | | | | | Task-number: QTBUG-94251 Change-Id: I5f06bba2522c07a29897501932c02b87e9cae356 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit ef91fb8ca4b44f94185f02c5cb229b67a9dce860)
* Revert "ToolTip: use contentWidth of Text contentItem to account for newlines"Mitch Curtis2021-08-161-20/+2
| | | | | | | | | | | | This reverts commit a063cd0be5e8f108a0084831856f4af8c0e9159c. It causes QTBUG-94764. Task-number: QTBUG-83630 Task-number: QTBUG-94764 Change-Id: Ib27d827e25d4e4cea805d0f8e3c32b8aa843ec6a (adapted from from commit 009a0262bc0436d4822a3438fc99e02ed15dfc69) Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickComboBox: fix acceptableInput being wrong if no validator was setOliver Eftevaag2021-06-171-0/+40
| | | | | | | | | | | | | | | | | | | This patch fixes an issue with hasAcceptableInput(), if the property would be read before the contentItem had been set by the qml engine. This would cause hasAcceptableInput to return false by default, even though the default value is supposed to be true, if no validators or inputMasks are being used. The solution that I've chosen, is to give the QQuickComboBox its own acceptableInput variable, and connect the contentItem's acceptableInputChanged() signal to a function that polls for the contentItem property, and updates its variable accordingly. Fixes: QTBUG-94307 Change-Id: I587d76162e75544a7ed1df9e3b9104bd73013bb0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit f8db2b996f339ad7e0754cd232f1e71ebecf6367) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add recursion guard to QQuickApplicationWindowPrivate::relayout()Jan Arve Sæther2021-06-172-0/+102
| | | | | | | | | | | | | | relayout() might change the size of the header, footer or contentitem When one of those items changes, QQuickApplicationWindowPrivate will get notified by that through QQuickApplicationWindowPrivate::itemGeometryChanged(). itemGeometryChanged() will then call relayout()... (*recursed*). Task-number: QTBUG-87708 Change-Id: I9403952e776afb2be37d009642c65b5520c79341 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 6dc95399797de4ec27984956df1fa587f4eb18ba) Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix SwipeDelegate losing swipes to parent flickablesMitch Curtis2021-06-171-5/+35
| | | | | | | | | | | Use a smaller threshold than Flickable so that it doesn't steal our events. Fixes: QTBUG-55705 Change-Id: I7e985c27788818226a3158078d485ea12ddd7006 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 887af04857f366c393512573cafebccde2678d6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Blacklist some flaky tst_qquickdrawer functions on openSUSEMitch Curtis2021-06-161-0/+8
| | | | | | | | Task-number: QTBUG-77946 Change-Id: I11f3e275d76833754a994d1bf09e50fa1328828c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5a2af8d9225cbbc70f9475cb722376cb065678cf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix warnings in some testsMitch Curtis2021-06-144-30/+29
| | | | | | | | | | | | | | | The warnings were all along the lines of: TestCase.qml:672: Error: Cannot assign [undefined] to double At some point the behavior was changed so that you can no longer pass undefined to initial property values, so account for that by having the data rows construct the properties object directly. Change-Id: I7180e9fc664650b87ae0305b7f829cd7266be1ab Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit c2d16c5fdc060f437e6cbee15bfa17c8a7f4ffe2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ToolTip: use contentWidth of Text contentItem to account for newlinesMitch Curtis2021-06-091-2/+20
| | | | | | | | | | | | | | | | | By default, QQuickPopupItem uses the implicitWidth of its contentItem, which is too large in the case of a ToolTip with newlines in the text. In that case, contentWidth refers to the width of the text including newlines, so we use that instead. [ChangeLog][Controls][ToolTip] The implicit width of ToolTips now accounts for newlines in the text. If you want to use the old behavior, set ToolTip's contentWidth to implicitContentWidth. Fixes: QTBUG-83630 Change-Id: I7ca3805429acb68a13ead8f3545bb84a51fb1b72 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit a063cd0be5e8f108a0084831856f4af8c0e9159c) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* TextArea: Detach the flickable when it is deletedAndy Shaw2021-05-261-0/+15
| | | | | | | | | | | | When the flickable is deleted before the TextArea is (which can happen when it is a child of a ScrollView) then we need to make sure that the TextArea no longer keeps a reference to the Flickable object. Fixes: QTBUG-93958 Change-Id: I1745065370718e60bc459192e15eae0e1ba36231 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 4cba29c38cb1b610bf896130050b6c14b7e10c71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Hide old scroll barsMitch Curtis2021-05-192-0/+65
| | | | | | | | | | | Reuse the hideOldItem added in 80f1186338bcf8c7d692b4fadfc46531c002c6b0 to unparent and hide them. Fixes: QTBUG-89126 Change-Id: I641e46571b8ac42e0e5080b6737f305ff59afd51 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 908aa77d16e00f2bccc0ddae0f8b61955c56a6a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickDial: Keep value integer if everything is integerFabian Kosmale2021-05-041-0/+15
| | | | | | | | | | | | | | | | If a user uses integer values for stepSize, from and to in a Dial, they most likely want the actual values of the Dial to be integers, too. Detect this condition, and store it in a new boolean member. If the condition is met, we round the value in QQuickDialPrivate::valueAt (which, due to floating point math might not be an exact integer). As a drive-by, reorder the boolean members to introduce no additional space overhead. Fixes: QTBUG-92214 Change-Id: If4633fae1d7d425ca7fb767c7284d6f8ea7ce78c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 42687caf7bc7496b838995f3fa68194ca8323da3)
* ScrollView: fix crash when scrolling with zero-sized itemMitch Curtis2021-04-261-0/+24
| | | | | | | | | | | Check if a Flickable type was actually set as the contentItem before accessing the pointer. Also warn that using a type other than Flickable is not supported. Fixes: QTBUG-93039 Change-Id: I1470766c6de02b7b601edf1375791d3147f26ab5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e7df2279bf5519703fd0b853abaa23947a599920)
* ComboBox: don't focus TextField when clicking on indicatorBartlomiej Moskal2021-02-181-6/+25
| | | | | | | | | | | | | | | | | Remove focusing editText for Combobox when clicking on indicator (when editable is set to true). Focus on Edit Text should be set only intentionally by user. Before this change, when focus was set on Combobox, it automatically set focus on editText. It was also happening when drop down indicator was clicked. Because of that, on some platform (like Android) virtual keyboard was appearing in case when it shouldn't be shown. Fixes: QTBUG-61021 Change-Id: I813dcc3099c919ec32f0683e7e60e6082c5bc389 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit fdece5a40729d7c370d920ddfcad2921183dbbec) Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io>
* Combobox: Fix initial set of inputMethodHintsBartlomiej Moskal2021-02-031-0/+1
| | | | | | | | | | | | | | | Fix for setting up initial inputMethodHints to Qt::ImhNoPredictiveText for Combobox. Before this change, Qt::ImhNoPredictiveText was never set for Combobox. As inputMethodHints() by default returns Qt::ImhNoPredictiveText value, setInputMethodHints didn't allow to set this value correctly. Task-number: QTBUG-61021 Change-Id: Ie4ec0d32fff7586bc3a8bd055b752000c0330fad Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b87cada5e386e5a16ff04cf50bd88e97c4819099)
* Fix popups with exit transitions blocking mouse events when destroyedMitch Curtis2021-02-022-0/+144
| | | | | | | | | | | | | | | | | | | | | | If a popup had an exit transition set and was destroyed upon e.g. being rejected, it would not destroy its modal dimmer, and so events would not go through to popups that were beneath it even after it was destroyed. QQuickPopup's destructor does indirectly attempt to call finalizeExitTransition() through a setParentItem(nullptr) call, but prepareExitTransition() returns false if it sees that the exit transition is already running, and so transitionExit() never calls finished(). This patch fixes the problem by explicitly calling finalizeExitTransition() in QQuickPopup's destructor if the exit transition is running. Fixes: QTBUG-89673 Change-Id: I468fae52f6a83ac314877c67d062028634bb7e17 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 51d416cdfd909aacd5047632a7cc1661a158731a)
* a11y: Fix ordering on header, content item and footer in PageJan Arve Sæther2021-02-023-1/+56
| | | | | | | | | | | | | | | Because of the previous behavior, the footer could be read aloud by the screen reader before the content item. And even worse, the footer could be read aloud even before the header in some cases. This made it hard for visually impaired people to use the application. The Page type was used by the Dialog type, so it also affected that. Fixes: QTBUG-75042 Change-Id: Ic3e8ec3f7dcf18af9262b1d35c986835c8da6900 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 4b1acb290dc8869d0d2d1250dc1ed415d6b6e202)
* Fix initial currentIndex in Tumbler when wrap is set to falseAlexey Edelev2021-01-141-0/+21
| | | | | | | | | | | | | | | syncCurrentIndex () function assumes that PathView is used as view for, Tumbler component, and states that actualViewIndex should be 0 while initialization. This statement is not correct when Tumbler is in non-wrap mode and uses ListView as view, where currentIndex is set to -1 by default. Fix actualViewIndex condition according to ListView logic. Fixes: QTBUG-84426 Change-Id: I4ef1e7b45399bf748968490f44b8909f3218d9bc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 1fe83c1fd3eb9abfd13a7b8c7adb2c2355d8ad4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* SwipeDelegate: ensure background and contentItem are resizedMitch Curtis2021-01-141-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the geometry of a control changes, this code is called: void QQuickControl::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QQuickControl); QQuickItem::geometryChange(newGeometry, oldGeometry); d->resizeBackground(); d->resizeContent(); if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) emit availableWidthChanged(); if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height())) emit availableHeightChanged(); } SwipeDelegate works by moving the background and contentItem together when it is swiped to expose the various delegates. Because this involves setting the position of the background, the check for background's x position being 0 in QQuickControlPrivate::resizeBackground() would fail and the background would not be resized at all. Fix this by making resizeBackground() virtual and don't check the x when checking if we should set the width. Similarly, in QQuickSwipeDelegatePrivate::resizeContent(), we should set the contentItem's width instead of just repositioning and resizing it vertically. Fixes: QTBUG-85770 Change-Id: I36684bf2797719db87fe93063cc7685efe594eea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 83f49d3f4c0041bf2c74ff1ff2eb03c5d37aa1f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Reset the opacity and scale properties after the exit transitionAndy Shaw2021-01-061-0/+50
| | | | | | | | | | | | | | | | By resetting the opacity and scale properties after an exit transition we are ensuring that it does not lose the original values that the user may have set. [ChangeLog][Important Behavior Changes][Popup] After the exit transition is finished, then the opacity and scale properties will be reset to their values before the enter transition is started. Fixes: QTBUG-87283 Change-Id: I2b192c96eaea2906d968341255e80cd19be177e6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit df33c79fb6579f94498164531777320e79c36fd5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QQuickHeaderView models to pass model testerVolker Hilsheimer2020-11-061-2/+6
| | | | | | | | | | | | | | | | | | Following 72e0d699cec09458ca9325035d477d4899e8e47b in qtbase, the model tester exercises additional code paths to verify correct row/columnCount implementations for flat models. This revealed a few bugs in the models used in QQuickHeaderView and the unit test: * neither QHeaderDataProxyModel nor the test models handled a valid parent index for calls to row/columnCount * QHeaderDataProxyModel::sibling passed the index on as parent Change-Id: I612e18030d837275614d61ce8987c93fff7f20a9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit bdc14837191dc81452fa7fbba20ba0a29e5fbebd) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QQuickAbstractButton: don't accept key release if we're not pressedMitch Curtis2020-10-222-0/+124
| | | | | | | | | | | | | | A control should have been pressed if it's going to accept a release. This prevents an issue where a menu opened by pressing enter (handled via attached Keys property) would instantly trigger the first menu item. Fixes: QTBUG-83698 Change-Id: I6b1afbb76f37623012472b2b1148b4862c159239 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit a5e1c787f6512013a092f7708c6928b5a9e263c2) Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Allow the preparation of the exit transition even if it did have focusAndy Shaw2020-09-151-0/+18
| | | | | | | | | | | | | | This amends 1a5a0a591c35dcf498a232a802087683f2244ecb so that it only sets the hadActiveFocusBeforeExitTransition variable if it is false, ensuring that it is correctly handled later on if it is true from before. This handles a case of closing, opening and then closing again in one function call. Task-number: QTBUG-85884 Change-Id: Ied4ca33045b005f5f666e63d85fb603e9350d982 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit b0b11a6d4ae8a03998a5c84b91d9cb0b75387059) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update the text when the inputted value is out of rangeAndy Shaw2020-09-111-0/+25
| | | | | | | | | | | | | | | | | | | | When the inputted value is out of range but it would be fixed to the previous value then it would not update the text correctly to show the corrected value. This ensures that it is updated as appropriate. Before it would check if the value had actually changed after it had been fixed to the corrected value. So if it was corrected to the original value then it would not see it as having changed. Additionally the displayText also has the original text before the change, so we have to force through an update to ensure the contentItem's text is updated too. Change-Id: Ic38787d0803ab59cd998f4e2871c613f1642e764 Fixes: QTBUG-85719 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 97d2d271233246ed8a0d8930c9110603bf7b03bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Material: fix binding loops when binding between attached propertiesMitch Curtis2020-09-033-4/+115
| | | | | | | | | | | | | | | | | | | | | | | | | The paletteChanged signal was used as the change signal for a lot of properties. The problem with this was this binding, for example: Material.foreground: Material.toolTextColor results in foreground being set, which emits paletteChanged. toolTextColor has paletteChanged as its change signal, so that is triggered and then the foreground binding is re-evaluated in the middle of already being evaluated. I haven't found a way to fix this for toolTextColor yet, so we temporarily skip emission of toolTextColorChanged when foreground changes. This means that some text will be the wrong color when foreground is changed after startup. For other properties, using more specific change handlers is enough to solve any binding loops. Task-number: QTBUG-85699 Change-Id: Ied52d4c38914765ed5c75e234954f4baabaaa9af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 7f29e89c26ae2babc358b1c4e6f965af6ec759f4)
* tst_qquickpopup: fix setOverlayParentToNull testMitch Curtis2020-08-261-0/+2
| | | | | | | | | Use the fix from 1d06eb3f8215b67c5061ee3a076df405724ff7ee. Fixes: QTBUG-86212 Change-Id: I407c56741806340235da81cca943b50cc6e92dd2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4d76bce10d8f71dd3dc79e30ff947afe866c5041)
* QQuickSpinBox: fix another "function expressions as statements" warningMitch Curtis2020-08-201-0/+12
| | | | | | | | | | | This amends d5fbbddd7794265f24d392d33c4874ac756cb9c9 by also fixing valueFromText(). Task-number: QTBUG-64151 Change-Id: I02b053bb4d4579e86eaaa2279826f3b103800fdf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 2d0794cbc73a6913bea075804f232c4996d5fc4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* SwipeDelegate: don't allow calling close() when pressedMitch Curtis2020-08-191-0/+46
| | | | | | | | | | | This conflicts with the behavior of SwipeDelegate. The released() or clicked() signals should be used instead. Fixes: QTBUG-85804 Change-Id: I06111b63941f54c06f0e1b828d17264f37d765d5 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 6f41c69c9bc5a0ce59444e40d3a55018f7994743) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* SwipeDelegate: don't emit closed() when already closedMitch Curtis2020-08-191-1/+20
| | | | | | | | | | | If the mouse is released while our position is 0, it means we were clicked, and we don't need to begin any transitions to close. Fixes: QTBUG-85806 Change-Id: Ic521f48e2977c1a99dbecaa585792a7798b9d749 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit f3a64b13725081eb94b05dbeb5f68a2298c9163e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prevent against re-entering prepareExitTransition after a focus changeAndy Shaw2020-08-191-0/+36
| | | | | | | | | | | | | | | | | | When a popup is hidden, then it will trigger a prepareExitTransition which can cause the active focus to be lost. If the popup's visibility is tied to that fact then it can retrigger the transition which means the active focus does not go back to where it should. Therefore, we check if hadActiveFocusBeforeExitTransition is false before going through that process as then it will only be called the first time the popup is hidden. Fixes: QTBUG-85884 Change-Id: I68054aeb48447617b4235ce6467514a17f1073ba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 1a5a0a591c35dcf498a232a802087683f2244ecb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add binary compatibility file for 5.15 for QtQuickControls2Milla Pohjanheimo2020-08-171-0/+11690
| | | | | | | Binary compatibility file added. Change-Id: I5cee4e537d40285c92c61963134656b3559abde5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Get the scale of the popup item when setting the parent itemAndy Shaw2020-08-172-0/+25
| | | | | | | | | | | | As there are some styles that will do an transition which animates the scale then we need to size and position based on the final scale it will have to avoid a jump after it has finished the transition. Fixes: QTBUG-84488 Change-Id: I4571eb18c921e81de319838ac0e8d3fe3513d438 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 64230bf97c18297f45bd5d7ccf99b510c8a612bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix crash on exit when centering Popup within Overlay in StackView itemMitch Curtis2020-08-162-0/+97
| | | | | | | | | | | | If a Popup is centered within an Overlay, and that Overlay is destroyed before the Popup, we must make sure centerIn is cleared so we don't try to access a dangling pointer. Fixes: QTBUG-84579 Change-Id: Icb2750f847f9d5710725bedc4d1c92bf4c122c03 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 04901b170e009d844232067446fdd56f270d155d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove bindings to parent in delegatesMitch Curtis2020-07-301-1/+1
| | | | | | | | | | | | | | | | Until we've decided whether to a) document that properties of parent should not be bound to in delegates or b) fix the warning that results from doing so after 8c72e634b3b0eacbfdee883bfc34994d3c19ed77, we can pre-emptively clean up a few places where it happens. Task-number: QTBUG-81976 Task-number: QTBUG-82393 Task-number: QTBUG-82989 Change-Id: I1e610613f6016ec1b9cf9ca33cdfb15d384731a8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 456d26e97ec7745fdbd1afaaaa6c1dc217eca060) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix tst_QQuickMenu::subMenuPosition()Mitch Curtis2020-07-141-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | We're still getting failures after QCOMPARE was fixed (in c78a960198d59fb9a9ddd83ad7098b1db396edfd): FAIL! : tst_QQuickMenu::Material::subMenuPosition(cascading,flip) Compared doubles are not the same (fuzzy compare) Actual (subSubMenu1->popupItem()->x()) : 3.88240550819e-11 Expected (subMenu1->popupItem()->x() - subSubMenu1->width() + overlap): 0 tst_qquickmenu.cpp(1532) : failure location Quoting Eddy: "[...] the threshold for double equality is one part in 1e12; the threshold for fuzzy-is-zero is likewise 1e-12; so 3e-11 is non-zero. One work-around, of course, would be to cast float(each operand) so as to get float's wider tolerance (one part in 100,000, null if less than 1e-5)." So that's what we do in this patch. Change-Id: Iecf1b6f4b2cf2c81eb652bb0f565ac682b024dae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 4b61d6f52b166ca2b4a2e38a2fc60d631372f6a7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickApplicationHelper: don't use QTest macros outside test functionsMitch Curtis2020-06-187-5/+103
| | | | | | | | | | This has no effect. Task-number: QTBUG-66320 Change-Id: Ie6efb26243178c4044ac0bc721c21ad89769c982 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 969a724352dfe3250efb871c70f9482d7b780165) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QQuickTextArea: resize background different when inside FlickableRichard Moe Gustavsen2020-06-021-0/+27
| | | | | | | | | | | | | When a TextArea is placed inside a Flickable (using the TextArea.flickable property), the background is reparented to the Flickable. For this to look good, the background should have the same size as the Flicable as well, so it doesn't end up with the size of the TextArea, which can be many pages tall. Change-Id: I75ead02c712f337c7e743f17aa8810a040519173 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 257054f2cc6d79e763a12b350ffcc18787d0ac8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* StackView: fix heap-use-after-free when pushing after clearMitch Curtis2020-05-291-6/+32
| | | | | | | | | | | | | | This patch extends the work done in aaec25a7 to cover all operations. Note also that b94889f4 does a similar thing to this patch and aaec25a7, in that it explicitly ignores operations that are done during the removal of elements. Fixes: QTBUG-84381 Change-Id: Id8bbbded39d8e58bcf0e8eedeb2dde794952333f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit b67cc148693de06370633cddf82a31664004e65c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>