aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix enum-compare warning in tst_qquicktextdocumentShawn Rutledge2024-04-031-6/+6
| | | | | | | | | | | | | warning: comparison of different enumeration types ('Qt::TextFormat' and 'QQuickTextEdit::TextFormat') [-Wenum-compare] Those have the same values anyway, but QQuickTextDocumentPrivate::detectedFormat has type Qt::TextFormat. Amends b46d6a75ac16089de1a29c773e7594a82ffea13e Pick-to: 6.7 Change-Id: Idc2bb54ebef8c5ef5c5bdac575c66ed3144b73f8 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Shortcut: Match window shortcut when its window is activeMohammadHossein Qanbari2024-04-022-0/+107
| | | | | | | | | | | | | | | | | | The window shortcut declared in the embedded QQuickView did not get activated unless the QQuickView was the focus window, instead of getting activated because the containing window was active. Now, the shortcut's window is checked to be active, and if it's not, the matcher dose not match the shortcut. The testcase creates a shortcut event in a window which contains an embedded window shortcut. It should pass when the embedded shortcut's window is active. Task-number: QTBUG-121785 Change-Id: I0a27904d73492f1f8ee129441872cc5f2482b785 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Make culled QQuickItemViewFxItems inaccessibleMorten Sørvig2024-03-302-0/+79
| | | | | | | | | | | | Otherwise, if they get QQmlInstanceModel::Pooled, they still appear in the accessibility tree. Fixes: QTBUG-100866 Change-Id: I14f80a2747a46ce6e4653974f29ae159bdff6c88 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_propertyrequirements: Recognize BINDABLE as equivalent to NOTIFYUlf Hermann2024-03-291-4/+7
| | | | | | | | A bindable property is effectively notifyable and QML can use the bindable to update other bindings. Change-Id: Iebd9780df9a6b3d949a6873e3c8ed44b71f51222 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* DragHandler: don't skip passive grab if state includes releaseShawn Rutledge2024-03-263-6/+3
| | | | | | | | | | | | | | | | If QQuickDragHandler::handlePointerEventImpl() is looking at an event with one released point and one stationary point, and minimumPointCount is 1, then it needs to have a passive grab of the stationary point in case it starts moving. The released point is irrelevant: it's not in d->currentPoints. We cannot rely on QTouchEvent::isEndEvent() as a precheck, because m_touchPointStates is Stationary | Released, and that includes Released, but it's not true that the whole touch sequence is ending. Fixes: QTBUG-123499 Change-Id: I20aeecc1f9c29200c324f3f7dc1e6b73fed21d30 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Use new Qt configure feature for MetalTor Arne Vestbø2024-03-255-5/+5
| | | | | Change-Id: I603018d3f4c6a49c39f7daed25101c24edbbfc02 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Adapt to privatising of QPropertyBinding's ref countUlf Hermann2024-03-251-1/+1
| | | | | | | | | | | Change-Id: I95474784c1eb8c8d8f5dafd33dcc32f532bffe47 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* QQmlGadgetPtrWrapper: Consider QVariant as possible typeThomas Hartmann2024-03-223-0/+65
| | | | | | | | | | | If the type is QVariant, we have to store and retrieve the member as-is, instead of wrapping and unwrapping it. Pick-to: 6.7 Fixes: QTBUG-123484 Change-Id: I01ac33158236b0f1082744aafa86108225b68392 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Correct license for test filesLucie Gérard2024-03-222-2/+2
| | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Task-number: QTBUG-121787 Pick-to: 6.7 6.7.0 Change-Id: Ib686439e6a61fd3169948dd8a2b51f8fe1ca21b1 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Correct license for examples filesLucie Gérard2024-03-211-1/+1
| | | | | | | | | | | | | Example takes precedent over build system file type. According to QUIP-18 [1], all examples file should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 6.7.0 Task-number: QTBUG-121787 Change-Id: Ie8c2539e7659f53a1fd6b48f99ee883ee9aeb0a7 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* quicktestutils: rename delegateVisible to isDelegateVisibleMitch Curtis2024-03-212-126/+126
| | | | | | | | Because it's the convention. Pick-to: 6.5 6.6 6.7 Change-Id: I1d3d53f5c051ede0b011c1daa9d1019cad8875f8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Flickable: don't start flicking on release unless grabbedShawn Rutledge2024-03-201-3/+1
| | | | | | | | | | | If Flickable grabbed a touchpoint on press and then the grab was stolen, do not start flicking in response to the release of the touchpoint. Fixes: QTBUG-113226 Pick-to: 6.7 Change-Id: I068a26f424afd655582b6415275df7a20e59d43c Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Modify tst_FlickableInterop::touchDragSliderAndFlickable to passShawn Rutledge2024-03-202-3/+4
| | | | | | | | | | | | | | We have a behavior change since Qt 5: if one finger drags a DragHandler in a child of a Flickable, a "stray" finger that touches the Flickable does not flick it. Time will tell whether this is a good change or not. But it's been that way in Qt 6 so far; and in the meantime it's best not to keep this test blacklisted because of one line. Pick-to: 6.5 6.7 Fixes: QTBUG-123490 Task-number: QTBUG-86729 Change-Id: Iad22211b4fe102c2c1d4d7f4c7485decc0aa17a8 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Stablize tst_qquickapplication::state() and active()Shawn Rutledge2024-03-201-4/+4
| | | | | | | | | | | | This reverts the fix from b06b7e9840d1102ae7359ee81e143bdc40c59a73: apparently the problem was that we didn't wait for the initial focus, not that we didn't wait long enough for it to change later. Fixes: QTBUG-75215 Fixes: QTBUG-122031 Change-Id: I452c7b177d3060ba40a107c26fc4568323eb1ef1 Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_TapHandler: unblackist OpenSuSEAxel Spoerl2024-03-191-8/+0
| | | | | | | | | | The test is no longer flaky on OpenSuSE. This patch unblacklists it. Fixes: QTBUG-95939 Pick-to: 6.5 6.6 6.7 Change-Id: Ief388369f6ada575474f47b768eb6fb6ac209a27 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Prevent infinite loop when setting activeFocusItem of the scene's rootDoris Verria2024-03-162-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we forceActiveFocus on a QQuickItem we set focus to all ancestor focus scopes, in their parent scope. That involves setting 'item' as the subFocusItem of its immediate focus ancestor. In Qt Quick 3D, where we have different subscenes, we follow the same approach as mentioned above, but at the same time, we would set the item that is getting focus as the activeFocusItem of the scene’s root item and by so doing, we would set the subFocusItem of all focus ancestors of that item to 'item'. This is not entirely correct since each focus ancestor's subFocusItem must be its nearest descendant with focus. But we would then proceed to go up the focus hierarchy of the item and this time try to set its ancestor as the activeFocusItem of the scene’s root, "undoing" what we had done in the previous step. This would cause a lot of unnecessary clearing and setting of the subFocusItem as well as focusIn/out events, and sometimes even infinite loops like in the case of compound controls, like the spinbox, which gives active focus to its textField content once it gains focus. To fix, don't change the subFocusItem of the scene's root item unless we have traversed up all the focus hierarchy. Fixes: QTBUG-120542 Pick-to: 6.5 6.6 6.7 Change-Id: Icf08edd2ff8b64662011f66c7137b44750cda9f2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* ListView: allow binding on x and y in footer and header delegatesOliver Eftevaag2024-03-133-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is generally a bad idea, but it's technically a regression that was introduced in f03a9839b689a3a1810846bb8ec08e02a9bf23b5. The reason why it's not recommended to bind directly on x and y in delegates, is because the delegate item positions are determined by the item views layout, which are in conflict with the positional bindings. However, it should be possible to partially support positional bindings in the header and footer delegates, in ListView. The reason for using the word "partially", is because a ListView with horizontal orientation, should always place the header first (with x typically being 0). But the y axis, can in theory be set directly, since it won't cause overlap with the remaining delegate items. Same idea for vertical ListViews. Except that the y axis become the "primary" axis, when the orientation changes to vertical, meaning that the x axis will then be safe to modify. The model-view-delegate doc page is also updated, to discourage people from binding directly on x and y, in delegates that are meant to be used for item views. Fixes: QTBUG-122665 Pick-to: 6.7 Change-Id: I78363e159f14827a28dba7c72d1ecef45b0c6d2a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Restore tst_QQuickTextDocument::overrideTextFormat() test caseShawn Rutledge2024-03-111-0/+5
| | | | | | | | | | This reverts commit b690491a5d3786c16421eb90aa4b4d627bff16c5. The test should be ok after bc1bdd0e15ad1fbc1ffb2af666b0ca5676858ee0. Task-number: QTBUG-123014 Pick-to: 6.7 Change-Id: I85530e568ec34d2334f79a2370c888cc7438efaa Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Make the QSGTexture native accessor query work on macOS/iOSTor Arne Vestbø2024-03-111-0/+54
| | | | | | | | | Also add an autotest. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-108019 Change-Id: Ie809041019b0a1b842791994e42d9d75578eb350 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Keep markup when toggling TextEdit.format: AutoText / PlainTextShawn Rutledge2024-03-091-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful when writing an editor that allows you to do wysiwyg editing or raw HTML/markdown. Usually you want `format: AutoText` because you don't know what the user is going to load, and we expect QQuickTextDocumentPrivate::load() to find the type from the URL extension (since b46d6a75ac16089de1a29c773e7594a82ffea13e). Then if the user toggles format to PlainText, that's assumed to be for the purpose of raw viewing or editing, not for the purpose of removing the formatting. (Switching to plain text can be accomplished by `textEdit.text = textEdit.getText(0, textEdit.length)` .) We adjust tst_qquicktextdocument::overrideTextFormat() slightly: loading an html document as AutoText and then converting to HTML no longer emits the textChanged signal (it's not really a conversion). Likewise, converting markdown loaded as AutoText to explicit markdown should not need to emit the textChanged signal. Amends fdbacf2d5c0a04925bcb3aecd7bf47da5fb69227 Done-with: Oliver Eftevaag <oliver.eftevaag@qt.io> Fixes: QTBUG-122985 Task-number: QTBUG-120772 Pick-to: 6.7 Change-Id: I1d43b5e5662197dfeb1a93a2d1f638a193aa66b2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Fail gracefully when binding an attached property where the object is nullVolker Hilsheimer2024-03-072-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Overlay.overlay is an attached property that holds the window overlay item, our documentation promises that it can be attached to anything, but will be null if the thing is not in a window. When using QQuickView on a QML code that declares an item which tries to bind something to the Overlay.overlay property, then the overlay will be null, and creating it will fail because there is also no window yet. This crashes further down processing when trying to create the binding. While this cannot be made to work (modifying the window is not possible in QML that doesn't declare a Window and is instead loaded into a QQuickView), it should also not crash. Add a nullptr check where it did crash, add a test that reproduces the crash, and with the fix merely spits out a warning. Fixes: QTBUG-122894 Pick-to: 6.7 6.6 6.5 Change-Id: Ie4438657a6855b44409edb28431e04eb9875a392 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io>
* Update test cases for change in default size policySanthosh Kumar2024-03-062-5/+116
| | | | | | | | | | The size policy of items updated as part of task QTBUG-117597. This patch adds an autotest for default size policies. Task-number: QTBUG-117597 Pick-to: 6.7 Change-Id: Ibc84b2d462885d1d31313040905e74e5bb072373 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_QQuickTextDocument::overrideTextFormat() remove failing data setAxel Spoerl2024-03-061-5/+0
| | | | | | | | | | | | | | | | | | | | The dataset "load html as autotext, switch to plain, back to auto" caused permanent failures, because plain text escapes the <DOCTYPE> header text and formatting tags, to mark them as metadata. While the conversion back to HTML works, the conversion to autotext keeps the escaping made in plain text. A behavioral change would be necessary, to amend the conversion logic. With the currently implemented logic, the specific test is bound to fail. Remove the test data set, to unblock submodule updates. Revisit the issue at a later point. Fixes: QTBUG-123014 Pick-to: 6.7 Change-Id: I0c5f461f17c4388dbd49796134e168a7afa0dd35 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Legitimize qWait()s in tst_qquicktexteditShawn Rutledge2024-03-051-12/+8
| | | | | | | | | | - if the next line is QTRY_something, we should not need a wait - if we're preventing double-click, wait for the appropriate amount of time Change-Id: Ic3078df315c1dca7f4f2bb2a6a69c231829e8830 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Use showView in most test functions in tst_qquicktexteditShawn Rutledge2024-03-052-316/+197
| | | | | | | | | | | | Cut down on boilerplate and avoid dynamic allocation. Many of them used requestActivate() before; showView() just calls show() and qWaitForWindowExposed(). It remains to be seen whether activating makes a difference in most of these. Change-Id: I1348b4661a3059635ebde7d9068c348c0bddb44f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Blacklist tst_qquickpixmapcache::slowDevice on all platformsMitch Curtis2024-03-061-1/+1
| | | | | | | | | | It's not just flaky on opensuse-leap. Task-number: QTBUG-118064 Pick-to: 6.7 Change-Id: I9b23b2c15ff445bdf0eb963499537fbfcfbf6234 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Prepare for white allocations during gc(8/9): Object creatorFabian Kosmale2024-03-051-0/+33
| | | | | | | | | | | | | | | | | | | | Modify the object creator's tracking of object wrappers. It already pushed them onto the JS stack, so that triggering the gc during object creation would not trigger the wrappers of (temporarily) unparented objects. However, with the incremental gc, this is not enough: We might have already started the gc, and are beyond the phase were we visit all QObjectWrappers. If we then resume the collector only after the object cretaor is done (and the scope has been destroyed), then we don't have any reference to the QObjectWrappers. Fix this by moving the wrapper handling into a helper class, which employs a write barrier to avoid the objects from being hidden from the gc. This unconvered an unrelated issue in the usage of QV4::Scope in QQmlObjectCreator::beginPopulateDeferred, which will be addressed later. Task-number: QTBUG-122956 Change-Id: I23755438e68aa1c82786e619105683d131c31c90 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* tst_HowToQml::timePicker: add more logging output to debug flakinessMitch Curtis2024-03-052-2/+14
| | | | | | Task-number: QTBUG-122679 Change-Id: Ie068ac579441f5ecc49a6543bcd989607ed96831 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix crash when item is deleted in event handlerPaul Olav Tvete2024-03-041-0/+34
| | | | | | | | | | | | QQuickDeliveryAgentPrivate::deliverPressOrReleaseEvent() creates a list of possible targets and iterates over it. This would cause a read of deleted memory if delivery to one target would cause another item in the list to be deleted. Fixes: QTBUG-91272 Pick-to: 6.7 6.6 6.5 Change-Id: I3f648e683d9b441ee0f14e4f721338ac59ace3cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use showView in tst_qquicktextedit::mouseSelectionModeShawn Rutledge2024-02-291-12/+8
| | | | | | | | | | | Not sure if this will have an impact on stability, but we have showView to standardize some boilerplate that was otherwise duplicated here. Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-78846 Change-Id: Ic0faec8b11d162fac49bd6679c0652e9760238be Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Hover event delivery: don't modify a list we are iteratingVolker Hilsheimer2024-02-292-0/+42
| | | | | | | | | | | | | | | | | | | | Delivering HoverLeave events might modify or even clear the list of hoverItems, which invalidates the iterators, and crash. Iterate over a copy of the list instead, and write the modified copy back to the hoverItems list if that hasn't been cleared while delivering events. To prevent that we deliver multiple HoverLeave events to items, check in the delivery logic that the item's entry in the map still has a valid ID for the event point. Streamline that code a bit by preventing multiple lookups in the flatmap, and instead use an iterator that we can use to update the existing entry if it's valid. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-122686 Change-Id: I5483e75884f1ddec37c4e98ecfee35e7596756c5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickTableView: remove syncView from destructorRichard Moe Gustavsen2024-02-292-0/+59
| | | | | | | | | | | | If a TableView has a syncView, we need to ensure that it detaches itself from the syncView when it's destroyed. Otherwise the syncView will have a dangling pointer to the deleted TableView afterwards, which can cause a crash. Fixes: QTBUG-120760 Pick-to: 6.7 6.6 6.5 Change-Id: I4c6acfaa0c623ea43ba8b938585fcd9c9247f66c Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Stablize a flaky test, tst_qquickapplicationInho Lee2024-02-292-8/+2
| | | | | | | | | | Use QTRY_VERIFY_WITH_TIMEOUT in order to give enough timeout for changing focus. Fixes: QTBUG-122031 Task-number: QTBUG-75215 Change-Id: Iea28c7a4bbb645715b679ac766772b57d5ccd1f3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add TextDocument.errorString propertyShawn Rutledge2024-02-271-2/+8
| | | | | | | | | | | | | | In bec8df96b7615c6ce419867254027773ea7fd6b1 we added status and removed the translated error string. But actually it's a common pattern to have the error string available too, so as to avoid needing to generate it from an enum value. Also, in the textEditStatusSwitch.qml snippet, setting textFormat is necessary after fdbacf2d5c0a04925bcb3aecd7bf47da5fb69227 Pick-to: 6.7 Change-Id: Ie880efa4bf347b70eb6cc4005283b1fc50e15508 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Correct license for test filesLucie Gérard2024-02-27355-355/+355
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Attempt to stabilize tst_how-to-qml's timePicker testMitch Curtis2024-02-261-14/+18
| | | | | | | | | | | | | | | | | | Top-level animations within a transition are run in parallel, which meant that the NumberAnimations that animated the opacity of the labels could technically be conflicting (even though it visually looked correct). This could explain why the test was failing when checking for the opacity to equal 1, and it was instead 0.96. Reduce the duration of the animations now that they execute in succession, as originally intended. Amends d414c81f38d8fea47d91c9414bdecda9ea7761a1. Task-number: QTBUG-122679 Pick-to: 6.6 6.7 Change-Id: I51c62d8c95d54194fd2fb2273c9644378d4b61e5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add imageSourceSize property to QQuickDragWang Zichong2024-02-243-1/+100
| | | | | | | | | | | | | | | | | | | | | | Currently we can only assign an image URL to QQuickDrag to represent the data during the drag and drop operation. We made it easier to load arbitrary images in ac78bf7074c4aa2414b4da38db5b574bec9e4b71 : it does not have to come from Item.grabToImage(). But the image size depended only on the image provider's default behavior. Now we give developers the ability to set a preferred image size when needed. The revision of this new property and its signal is omitted because of QTBUG-33179. [ChangeLog][Qt Quick][Drag] The attaching type Drag has a new imageSourceSize property, which can be used like Image.sourceSize to scale the drag image during loading. Fixes: QTBUG-122705 Task-number: QTBUG-120489 Task-number: QTBUG-33179 Change-Id: I92996b8f70b7ca1c9ab783d7ed9f21649d512ab9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Respect TextEdit.textFormat in TextDocument load(); detect formatShawn Rutledge2024-02-214-14/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't load rich text if TextEdit.textFormat is PlainText. Thus it should be possible to have two independent TextEdit instances with independent document instances, viewing the same source file: the raw syntax and the rich/WYSIWYG formatting visible at the same time. Also, after the QQuickTextDocument's QTextDocument has already loaded the declared source, don't let QQuickTextEdit::componentComplete() replace it with empty text from the (unbound) TextEdit.text property. That was happening only if textFormat was RichText or MarkdownText. In case the user transitions TextEdit.textFormat from AutoText to any other, the text property now holds the format that was loaded from TextDocument.source; QQuickTextDocumentPrivate remembers the format rather than the mime type (because QMimeType is an optional feature in Qt); and TextEdit functions such as getFormattedText(), insert() and append() behave as if the textFormat property had been appropriate for the loaded file type in the first place. We cannot algorithmically detect markdown text by looking at the text itself; but now, QQuickTextDocumentPrivate::load() can populate markdown or html text into the document by detecting the file's mime type, even if the textFormat is AutoText. After that, if the user changes the textFormat to PlainText, we assume that they want to see the raw markdown or HTML. Amends b46d6a75ac16089de1a29c773e7594a82ffea13e : it already seemed odd at the time that it was OK for QQuickTextDocumentPrivate::load() to load any text format, without first changing TextEdit.textFormat to match what's expected. The default is PlainText, so it didn't make sense to read e.g. a markdown file and have the result look like WYSIWYG rich text. Now you have to change textFormat to MarkdownText or AutoText beforehand if you want to see WYSIWYG; and tst_qquicktextdocument::sourceAndSave() needs to do that too. On the other hand, if you switch textFormat to PlainText, we convert the QTextDocument to plain text, using Qt-generated markup/markdown syntax. Maybe the user would prefer to have the original syntax as read from the file; but so far it has always been this way: we just parse it, we don't store it. We are quite incapable of incrementally modifying the original syntax anyway: we can only regenerate it wholesale. So it makes sense that the text property holds Qt-generated syntax after the parsing is done. Pick-to: 6.7 Fixes: QTBUG-120772 Change-Id: I7db533c714e14bb4eb36745996c732e5162fb9cf Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* HoverHandler: setHovered(false) for any pointer event outside boundsShawn Rutledge2024-02-212-37/+54
| | | | | | | | | | | | | | | | | | | | | | | | | 8e822e981d91e688799c8670f11dfdf6aaf9e0d1 was expecting HoverHandler to receive a QTabletEvent when hover leaves. That worked before bbcc2657fa0dbf715e6db7d675662e4be94a1e04: a HoverHandler had a passive grab, so it would receive the next QTabletEvent that moved outside the item. Now that we stopped doing passive grabs, the event that indicates that the cursor is leaving the item is always a QMouseEvent sent from QQuickDeliveryAgentPrivate::deliverHoverEvent(). If the mouse event says the cursor is outside the item, it doesn't matter what device it came from: this handler is no longer hovered. But as before, if the position is still inside, and a particular HoverHandler is hovered because a tablet stylus was previously detected, do not un-hover merely because of a synth-mouse event at the same position. Amends 79893e1773be9d04208243cb88c1daf793d830a4 Fixes: QTBUG-116505 Task-number: QTBUG-101932 Pick-to: 6.5 6.6 6.7 Change-Id: Id0b622fad524ae4be8b37b9cb55e68384056964a Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Layouts: Make {Row,Column}Layout.uniformCellSizes visible to QMLJan Arve Sæther2024-02-201-3/+34
| | | | | | | | | | | | Problem was that the property uniformCellSizes was inherited from QQuickLinearLayout, while it was only the concrete subclasses QQuick{Row,Column}Layout that was registered in the QML engine. Marking QQuickLinearLayout as anonymous solves this issue. Pick-to: 6.7 6.6 Fixes: QTBUG-122024 Change-Id: I9612de2c43ba1219278ffbd417563e5c2788458c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Blacklist tst_qquickhoverhandler::window on OpenSuseShawn Rutledge2024-02-191-0/+3
| | | | | | | Task-number: QTBUG-122405 Pick-to: 6.6 6.7 Change-Id: If5b9a3bb38b1fe44dc3e8891b04c34659be23eff Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Rename TextDocument.Status.SaveDone to SavedShawn Rutledge2024-02-191-2/+2
| | | | | | | | Loaded/Saved is more consistent. Pick-to: 6.7 Change-Id: I5c773ff67198f439f3501bc338da44e5d32e3330 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Flickable mouse wheel: overshoot less, and return to bounds soonerShawn Rutledge2024-02-191-0/+42
| | | | | | | | | | | | | | | | | | | | | | Overshoot behavior with a physical mouse wheel now "feels" more like 6.5 again. - starting at the edge of scroll extents: don't begin overshoot at all - reaching the start/end of bounds while moving: overshoot depends on velocity (momentum), but additional wheel events don't cause the overshoot to increase Amends b1766d9d629f61d824146e69f1f3b319cbee3d11 and generalizes the idea from e034a18dfa7bc14c85d2a5641bcc0f2673199516: part of that logic now applies to all values of boundsBehavior. There is no change if the wheel event has scroll phases, nor if QT_QUICK_FLICKABLE_WHEEL_DECELERATION has been set to less than 15000 to restore pre-6.6 behavior. Fixes: QTBUG-121349 Pick-to: 6.6 6.7 Change-Id: Ic2c755fd3714c491d2ce4ff58182371759cc73f8 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* tst_qquickanimatedimage::currentFrame: start in paused stateShawn Rutledge2024-02-131-0/+1
| | | | | | | | | | | | | | This test calls setCurrentFrame() and observes the results. It's more reliable if the animation timer is not running. Amends a439a25f468d8c5623f2e0949b55a0c85c850f5f Fixes: QTBUG-122173 Fixes: QTBUG-122111 Pick-to: 6.5 6.6 6.7 Change-Id: Ibd42ba47e208f3067d3349d54c272d1ec6886ee1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid dangling pointers in QQuickTextEdit::resourceRequestFinished()Shawn Rutledge2024-02-125-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we encounter an error while trying to download a network resource for a document (for example an inline image URL has an invalid protocol, or the web server returns 404), we call QTextDocument::resource() one more time, in case a placeholder image is to be returned. That will call back to QQuickTextEdit::loadResource(), which will delete the QQuickPixmap "job". Break out of the loop, don't keep iterating on the same pixmapsInProgress list that we're deleting it from. Likewise, break out if resourceRequestFinished() deletes the job itself. So now we expect resourceRequestFinished() to run its loop more often rather than continuing the first run until pixmapsInProgress is empty; but as before, don't invalidate() until all resource-loading jobs are done (pixmapsInProgress is empty). Also, as a hypothetical improvement to thread safety, erase() from the QList before deleting; and don't dereference the iterator again when we've already done that once at the top. Amends 7fb39a7accba014063e32ac41a58b77905bbd95b turtle.svg for the autotest is from https://openclipart.org/detail/235021/silhouette-turtle Fixes: QTBUG-122108 Pick-to: 6.7 Change-Id: Icfcaba7b42c68b572efda15b1ddc791010701bfa Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Refactor error handling in QQuickTextDocumentPrivate::load()Shawn Rutledge2024-02-122-0/+74
| | | | | | | | Ensure that the status property changes in case of any kind of error. Pick-to: 6.7 Change-Id: I3264a045ccf88b70e864106c1706f78b4a579aaf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Blacklist tst_qquickapplication::state() on opensuseUlf Hermann2024-02-081-0/+3
| | | | | | | | It fails all the time. Task-number: QTBUG-122031 Change-Id: I4fff01c14b8cb071da203ba59679da875d255e2a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQuick: Do not crash on broken statesUlf Hermann2024-01-302-0/+21
| | | | | | | | | | | | | | States can be nullptr these days. Ideally we'd warn about this, but for picking back to 6.5 it's enough to restore the pre-6.5.3 behavior and not crash. Amends commit f905876d6c3abda34dfd85cd40e300a31c1ebe52. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-120301 Change-Id: I87021eb2dcbe7fc49f37c5d949d79466ae341a1c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Force text layout update in the thread where its createdSanthosh Kumar2024-01-263-0/+49
| | | | | | | | | | | | | | | | | | | | | | | The text layout gets updated while invalidating font data. This creates an issue when quick text instance was created and invalidated across different threads. It mainly affects QQuickText::lineLaidOut() signal as QQuickTextLine is designed to provide information only about current line and its to be noted that the current line provided by QQuickTextPrivate was from stack. Thus, triggering this signal across thread provide invalid line information. Its possible to keep line in heap but that doesn't help as the ultimate purpose of QQuickText::lineLaidOut() signal is to provide current line information which user can hook to modify its geometry. This patch makes updateLayout() to be happening in same thread where the quick text object was created. Fixes: QTBUG-113039 Pick-to: 6.7 6.6 6.5 Change-Id: Ic0737cb514f663f87ac1cf21506ad76fee03643e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* DA: align delivery of mouse, touch, and synthesized mouse events to ↵Richard Moe Gustavsen2024-01-241-47/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | childMouseEventFilter Currently the delivery of pointer events to childMouseEventFilters differs depending on if the event is a mouse, touch, or synthesized mouse event. If case of a mouse event, it will be sent to all the filters up the parent chain, even if one of the filters along the way returns true. If it's a touch event, propagation will stop as soon as a filter returns true. What does it mean that childMouseEventFilter returns true? According to tst_QQuickWindow::testChildMouseEventFilter(), if a childMouseEventFilter returns true, the event should be stopped from being sent to the receiver, and only the receiver. It should not be stopped from propagating to other childMouseEventFilters up the parent chain. This is explicitly tested with data row "r1 rejects and filters". Therefore, in order to make testChildMouseEventFilter() pass, not only for mouse events, but also for touch and synthesized mouse events, this patch will make the following changes: 1) Remove the early 'return' statement after a touch event was filtered by a childMouseEventFilter. This will make sure that the touch event will continue to propagate to parent childMouseEventFilters, equal to how it works for mouse and synthesized mouse events. 2) For both touch-, and synthesized mouse events, we deliver a (localized) copy of the original touch event to childMouseEventFilter(). The filter can then choose to accept or ignore this copy. But as it stood, we would never sync back the accept state from the copy to the original event. The result was that the original event would continue to propagate, regardless of accepted state set by the filter. This patch will therefore sync the accepted state from the copy back to the original event, when the event is filtered. This will make sure that if a filter e.g ignores the event, the receiver will not receive the event (since it was filtered), and the event will propagate to the parent (since it was ignored). Which is equal to how it works for mouse events. 3) For both touch and synthesized mouse events, we used to always set an exclusive grab on the affected event points if a childMouseEventFilter filtered an event. This is different from mouse event delivery, where we only set a grab when the event is also accepted. And the latter is also (most likely) the correct thing to do; If the event is ignored, it means that the filter says (on behalf of the receiver) that it doesn't want the event. And it doesn't make sense then (AFAICS) to still grab the event points. This patch will therefore, equal to mouse event delivery, ensure that we only give a filter an exclusive grab on the touch points when the event was actually accepted. With these changes applied, we then also change the tst_qquickwindow::testChildMouseEventFilter() to run three times, once for mouse event, touch events, and synthesized mouse events, to verify that they're all aligned. Fixes: QTBUG-115953 Pick-to: 6.7 6.6 6.5 Change-Id: I8b5b1faadc907e804b7e21c667888db7cfe28872 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>