aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
Commit message (Collapse)AuthorAgeFilesLines
* Avoid stale QSGTexture pointer accessesRomain Pokrzywka2021-05-041-1/+3
| | | | | | | | | | | | | | On rare occasions, it seems to be possible for the texture to be used after deletion, which results in crashes in pixmap() after casting. Rather than storing a raw pointer, wrap the texture in QPointer to avoid the stale pointer accesses. Task-number: QTBUG-80415 Change-Id: Ia0ee556f4a3a4eee777ca14065635f4bc5f90da2 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 1c010b202506bb7eb0f0e24ab37ad50e319abada) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove documentation references to NVPR rendererAndy Shaw2021-04-191-18/+1
| | | | | | | | | | | Since this is no longer supported, it is removed from the docs Change-Id: Id23716594e6ea9fd3d05d88a2586d380d1db09db Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Nico Vertriest <nico.vertriest@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 39de040452d25c3a279599519638890859d483b8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTextInput: update cursor rectangle after padding changedWang Chuan2021-04-161-0/+5
| | | | | | | | | | | The position of cursor delegate needs to be updated when we change padding, otherwise it will be in a wrong position. Fixes: QTBUG-91867 Change-Id: I89ca84fe893ebf517ab67890196eede14a4055d7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit d98694c4023881673259ba040c10df7e71ec3d37) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItem::forceActiveFocus(): actually force active focusShawn Rutledge2021-04-161-0/+10
| | | | | | | | | | | | | | | | | | | | | It was trying to get by with setFocus() but that doesn't always work, in cases when the item's d->focus flag is true (leftover state) but it doesn't actually have focus anymore after a reparenting scenario. Item.focus represents the intention to be focused when possible, and does not necessarily change due to environmental circumstances, such as having its parent reparented. QQuickItem::setFocus(true) returns early if the new requested focus state is the same as the stored d->focus; so it was not enough for foceActiveFocus() to call only setFocus(). In the bug, TextInput and Loader both get stuck in the state d->focus == true, so forceActiveFocus() did not do anything before. Fixes: QTBUG-89736 Change-Id: Ib7f4caccf81b60a02e2655332b64efba4d1fd7cf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit a8be17a1472c6f504c0c40f68fdc13df035ac4b4) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: Fix qml module version to use the repo project versionAlexandru Croitor2021-04-161-1/+1
| | | | | | | | | | | | Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION, so that the repo project version is used in a top-level build, rather than the version of the qt5 project. Task-number: QTBUG-92861 Change-Id: I5a7a09baf81353558e512800746ac24e8e8b9a47 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit cd7bd71d08f1c21648756d0a9fd501ce37a8cc0c) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Do not batch lines with > 1 width in alpha passLaszlo Agocs2021-04-121-1/+5
| | | | | | | | | | | | Cannot possibly do reasonable overlap checks when we have no idea how such lines are rasterized, meaning we do not know the real bounds of the geometry. Fixes: QTBUG-91749 Change-Id: Ia444232330da2f1d29841589f0e65bb52822c4ae Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 74c458f9fdf0639cd68684b5184bf561166e14cb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Consistent naming for (to|from)Is(Defined|Sourced) in animationsAndreas Buhr2021-03-316-39/+38
| | | | | | | | | | | | | | | | | | | To store whether "from" and "to" values are defined and/or sourced, QQuickPathAnimationUpdater used fromDefined format, QQuickAbstractAnimationPrivate used fromIsDefined format, QQuickAnimationPropertyUpdater used fromIsDefined format, QQuickAnimatorPrivate used isFromDefined format, QQuickBulkValueAnimator used fromDefined format, QQuickAnimationPropertyUpdater used fromDefined format. This patch changes all these to use the variable names "fromIsDefined", "fromIsSourced", and "toIsDefined". This makes the code more readable. Change-Id: Ia6c228208eb651247b0ba70f83afadb5b1027049 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 702b00bc8bfdc51592a01c9b7ed5939d85a7e192) Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquicktextinput: ensure we update IM when cursor changes positionRichard Moe Gustavsen2021-03-301-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Normally the cursor will change position inside a text input after receiving a touch or a keypress event. But it can also change position by sending it a QInputMethodEvent. But as it stood, we would in that case not inform the platform input context about it, which meant that the IM state in QQuickTextInput would be different from the IM state in QPA. A bug on iOS could be seen from this when dragging the cursor around using the magnifier glass. In that case QIOSTextResponder would move the cursor in QQuickTextInput using QInputMethodEvents. But since this would not be forwarded back to UITextInput, the result would be that if you e.g pushed backspace on the input panel, you would delete the character at the position the cursor had before the drag. This patch will ensure that we update platform IM state whenever the cursor changes position from QInputMethodEvents. Fixes: QTBUG-72757 Change-Id: Ic39c60fbce982f80d014befddbb2d4439ddeea4f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 04c0615352e947a23bcd52a0da4f901b3decdb87) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* DelegateModelGroup: Fix bug where item could be removed from the modelJan Arve Sæther2021-03-301-9/+93
| | | | | | | | | | | | | | | | | | | | | | | If an item was removed from the DelegateModelGroup before it was completed it caused subsequent items in the model to be missing in some cases. The reason was that while populating the ListView, it iterated with an index for each item to call createItem() on. However, createItem() might call onCompleted (which in the case of QTBUG-86708 removed the item from the DelegateModel), which caused the next index we called createItem() with to be wrong (it became one step ahead). We therefore add a helper class MutableModelIterator, which keeps track of if a index in the model got removed (and if the iterator index needs to be adjusted because of that).... Task-number: QTBUG-86708 Change-Id: I33537b43727aed4f2b9bdda794b011b6684c44b4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0ff9db566c48172c688bf9327fe6a781dc4a1c34) Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickTableView: always update content size when rebuilding small tablesRichard Moe Gustavsen2021-03-292-2/+26
| | | | | | | | | | | | | | | | | | | | | If you have a TableView with only a couple of rows, and you add a third one, the contentHeight doesn't update. This is fine if not all rows are loaded (some are outside the viewport), but when they are all inside, it should update to reflect the exact height. The same is also the case for the contentWidth. If you add a new row that increases the with of a column (and all columns are visible), the contentWidth should update. This patch adds an extra check when we do a rebuild (which we do when you add a new row), to see if all rows or columns are loaded. And if that is the case, we update contentHeight or contentWidth, respecitively. Fixes: QTBUG-92099 Change-Id: I806bfb7c3606fca97c5d27cbb91856cc40df9fb8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d6a5afd120838647e0dd2a420dacf06389f0a48e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PinchHandler: scale incrementally when new pinch gesture beginsShawn Rutledge2021-03-253-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When the gesture begins, we begin multiplying the target item's scale by 1.0 at first; it doesn't make sense to start immediately with the accumulated scale remembered from previous pinch gestures, because the target item remembers its own scale. When QQuickPinchHandler::wantsPointerEvent() returns false because some irrelevant gesture was received (for example a PanNativeGesture), that's not a good reason to deactivate. Deactivating and re-activating with each ZoomNativeGesture event results in extreme behavior, because PinchHandler depends on the BeginNativeGesture and EndNativeGesture events to reset internal state. Likewise, the fact that the button state is NoButton is not a good reason for wantsPointerEvent() to return false. Added an autotest: the first of its kind that actually simulates the native gesture events. Fixes: QTBUG-92064 Change-Id: I3a9b92d70f99497ee58ad8557d90d521fbe16d41 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit fc636af3a723ee8b4ee42cf71864ae0df5ca4621) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTableView: forceLayout() should work, even when no items are loadedRichard Moe Gustavsen2021-03-231-3/+9
| | | | | | | | | | | | | | | | | | As it stood, we would return early from forceLayout if no items were loaded. This made sense, since when no items are loaded, there would be no items to lay out. But after we changed the logic so that an application can show or hide rows and columns by returning an empty size from the size providers, we now always need to do a layout to check if some rows or columns should become visible. Fixes: QTBUG-92076 Change-Id: I2a07bf8e62cfeebcbe36c01aa92eca3ed8227cd3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 9ba9336ec4515d157a1207fad1dcd2de311527ac) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Use unique_ptr to clarify ownership of QQuickDefaultClipNode objects"Volker Hilsheimer2021-03-231-5/+5
| | | | | | | | | | | This reverts commit 02c6e7bc3aca42a188b772aa9794b919e60017e7. It broke text selection, the currentClipNode pointer must not be reset to nullptr even if ownership is transferred to a node. Change-Id: Ia66f7ed4be17916f3725bd3cb2cbd0e7c9d6327a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 68324c56c1b8f4ad5dfcdc6f77abda3eedaf2dfd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Call commitTextureOperations for small atlas texturesRoman Genkhel2021-03-231-1/+3
| | | | | | | | | | | | Atlas textures with size not greater than QSG_ATLAS_TRANSIENT_IMAGE_THRESHOLD are not visible Fixes: QTBUG-91182 Change-Id: I4e72e1c32c15b9e1a21cdb07262f219cc641bb5f Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a7b32a3e893892fc96d58af110af568043f09e72) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add missing } and indent accordinglyAndy Shaw2021-03-201-1/+2
| | | | | | | Change-Id: I11331f0f0434f2888d1f64aa01f999f42a15bdda Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 13ab07e932725d8c76208c265b60031e37305704) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use unique_ptr to clarify ownership of QQuickDefaultClipNode objectsVolker Hilsheimer2021-03-191-5/+5
| | | | | | | | | | | | | | | | The clang static analyzer warns in 3df1fff15a10a64372ed4f92ba05271f about a potential memory leak. While that particular claim is a false positive (the loop is always entered if sortedIndex is not empty), the re-use of the currentClipNode variable makes it hard to follow the object ownership, and there might still be a potential memory leak. Use std::unique_ptr to force explicit transfer of ownership, and get implicit destruction of objects not owned at the end of the scope. Change-Id: If826e1d81b92f1da60aae2262b628dcaaa2e592a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 02c6e7bc3aca42a188b772aa9794b919e60017e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickWindow: don't leak old screenChanged connectionsAndreas Hartmetz2021-03-111-4/+3
| | | | | | | | | | | | | | | | | | Connections could accumulate. Because the newest one was invoked last due to how signal-slot invocations are ordered, rendering was correct, but the stale connections caused unnecessary updates (and wasted a small amount of memory). This comes from a misunderstanding I had at the time about how QMetaObject::Connection works. Destroying or overwriting one does not affect the actual connection. While at it, also modernize the connect(). Change-Id: Idde81bdbff8947ed517bf2740d623a395c0acb74 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 9f8292d48913c5bc50377749c2b3e030cf16d703) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port shader code example in GridMesh docsLaszlo Agocs2021-03-101-13/+23
| | | | | | | Change-Id: Ic3a11d24fdc02fa383350997083b38407d75feab Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit ef16f8876d70c9fab4780f5063dc463e38ba3056) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickPaletteProviderPrivateBase: use palette getterFabian Kosmale2021-03-011-1/+1
| | | | | | | | | | | Otherwise, we can get a crash in QQuickPopupItemPrivate, which does not have a palette when using the Fusion style (so m_palette is nullptr), but instead hands us its popup's palette. Change-Id: Ib472139735dc3a7892771c6097267c0ec6902a99 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6b8a6b9fc86e94c1160d640a2b9718a7ae275b08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix typo in QQuickGraphicsConfiguration docsLaszlo Agocs2021-02-261-1/+1
| | | | | | | Change-Id: Ia1ca8276560f913e84b9e4c119cd1ced89737790 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 1a738838c4a199c61fce32c7eaba466181526335) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Improve QSGMaterial docsLaszlo Agocs2021-02-191-15/+31
| | | | | | | | | | | | | | Remove a Qt 6.0 editing issue where the docs continue saying "QSGMaterialShader and QSGMaterialShader", which is a leftover from 5.14/5.15 times when QSGRhiMaterialShader still existed. While we are at it, improve the code snippets and talk a bit more about type(), inspired by recent mailing list discussions. Change-Id: I4b21ed00285bf18e22e64a7574a273abdf8be3e5 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 258077e00eb8f3f4b0ef21a9a0395268b6c86532) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qquicktextinput: Fix validation for IM eventBartlomiej Moskal2021-02-192-2/+28
| | | | | | | | | | | | | | | | | | If validation did not pass after text pre-editing is finished, it need to be roll back to state before pre-editing started. Before this change, if validation did not pass, text was always rolled back to previous state. In pre-editing text case, it means back to the state in which part of the text was removed (and later changed to pre-edited text). It may cause a situation of removing part of the text that was already validated Fixes: QTBUG-90239 Change-Id: I3ec39e0f6b8a93d4e6fd190af30d4c80a0e495eb Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit b1ae151acc80254ab0ec2937c55b99223205875c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qquicktextinput: Fix Undo history for IM eventBartlomiej Moskal2021-02-151-4/+6
| | | | | | | | | | | | | | | | | | | Do not set m_cursor (cursor position) before calling removeSelectedText() in processInputMethodEvent(QInputMethodEvent *) method. Before this change, DeleteSelection command was added to history with new cursor position. If this command will be later rolled back, cursor position will not be set correctly. It should be set to position before handling the event. Task-number: QTBUG-90239 Change-Id: Ib5e46d232e6b32f904e745da4f9e5bc03a58963f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 6ec8c62ca22c363fa00e085de10198a90e3d65dc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MouseArea: fix containsMouse behavior during visibility changesVolker Hilsheimer2021-02-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickItem returns whether it contains QGuiApplicationPrivate's lastCursorPosition. Since that position stores the coordinate last seen by Qt (the window border), it will always be within the window, and within an item that covers that part of the window's border. However, QQuickWindow stores the lastMousePosition as well, and resets that value when it receives a QEvent::Leave. We can use that to test whether the window that contains the item has seen a Leave event, in which case the item is definitely not under the mouse. Notes on the test: That we use QPointF() as the "reset" value leave the small possibility that the cursor might be at position 0,0 of the window (ie inside the window), and the QQuickItem there will not be under the mouse. We can't confirm this (through an expected failure test), as QTest::mouseMove interprets a QPoint(0, 0) as "center of the window". And since we can't simulate mouse moves outside a window's boundary using QTest::mouseMove, the test needs to explicitly synthesize a QEvent::Leave for the window. Fixes: QTBUG-87197 Change-Id: I04870d6e914092275d9d790312fc702fb99f2935 Done-with: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ba1246c543118515ea244787f3d7f9c1133ccf0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSGBatchRender: avoid crash if buffer shrinksFabian Kosmale2021-02-081-2/+2
| | | | | | | | | | | | | The QRhiBuffer does not shrink; thus we can end up with buffer->buf->size > buffer->size. This would subsequently lead to an out-of-bounds memory access, and a crash. Fix this by using the uploadStaticBuffer overload which takes the size. As a drive-by, remove pointless QByteArray::fromRawData call. Change-Id: I40058ada6a6a5eb745ae559e8c9ed474fd41f75c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit f0a51eef5696782ec325b20f14cfe353d0a58d20) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Invalidate external renderpass descriptors from Quick3DLaszlo Agocs2021-02-053-0/+19
| | | | | | | Change-Id: I362b35b3d038d4fb24fab0e73cb120027f2308ea Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 93fe74ca433850e505f8f8940e99f3bf6a6dc050) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove superfluous include directiveFriedemann Kleint2021-02-031-1/+0
| | | | | | | | | | | | It is not conforming to the include conventions (module missing) and thus breaks the Qt for Python doc build. Introduced by 48b4c1f450109b148f03f62574d78b460859c4a1. Change-Id: I1ff56a967c457f1909b7f6e2e430458e3a3f47c9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit ecd54e68b90ad7022d1bdb71f1c1640ab392adae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickWindowIncubationController: Use QPointer to guard QSGRenderLoop referenceMike Achtelik2021-01-261-3/+3
| | | | | | | | | | | | | | In some cases, when the QGuiApplication is shutting down while there is an active QAnimationDriver and an incubating object, the QQuickWindowIncubationController will try to access an already destroyed QSGRenderLoop. So use a QPointer to guard the QSGRenderLoop access. Fixes: QTBUG-90489 Change-Id: I528e06ff22dfcad804593db6771d9163b21808f4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit bac93541ba324e75c532c1987e861109e1c5b131) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* export QAcccessibleQuickItemJan Arve Sæther2021-01-221-1/+2
| | | | | | | | | | | | This is needed in order to make controls in qtquickcontrols2 module more accessible. Their accessibility implementation can now inherit from QAcccessibleQuickItem Task-number: QTBUG-75042 Change-Id: I30deba018825937a4ebd757e5250efca87519822 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 21b975f186e6cec81914b6ee9a6aae5b847069d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ensure we cancel touchMouseSynthesis upon receiving touchCancelRichard Moe Gustavsen2021-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | As it stood, we wouldn't cancel touchMouseSynthesis after receiving a touch cancel event. The result would be that the first touch event sent to QQuickWindow thereafter would have touchMouseId set to value different from -1. This again would fool QQuickWindow into believing that the event belonged to a touch event it has synthesized before, and it would as such take a different/wrong path for delivery. This caused text selection to fail on iOS, since a press-and-hold on a line edit from QPA would cancel the touch event and show a magnifier glass. When the user later touched inside the line edit again to move the cursor, this new touch event would not be delivered to the text edit. Fixes: QTBUG-90485 Change-Id: Iad640ae57317ea86ee68ca053654b0b30ade003a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a738c3566790c6e9abeea3c4c3dacfceaa82f66a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Change QQuickShortcut::setSequences to bind to all sequencesAndreas Buhr2021-01-151-23/+60
| | | | | | | | | | | | | | | | When binding a Shortcut to a standard key sequence like QKeySequence::FullScreen, it binds only to one key sequence, even though there might be multiple key sequences associated. This patch changes the code to emit a warning in this case and allows to bind to multiple key sequences using 'sequences: [ <key> ]'. Fixes: QTBUG-88682 Change-Id: I88998aa8858d8f2c0c86e46bae94afd7ceb15b66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 6511b17038627ac30cb6622b13c7d46d9877bac5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass QWheelEvent data to QML engine via QQuickWheelEvent pointerVolker Hilsheimer2021-01-155-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing events as objects or references in signal parameters requires copying, and we removed the broken copy semantics from QEvent for Qt 6 as much as possible. QVariant::fromValue still allows creation of a QVariant from a type that doesn't have a (public) copy constructor, which is why this passing of a QWheelEvent through a QVariant to QML went unnoticed. While QWheelEvent is a gadget and thus supposed to be invokable from QML, it's still a QEvent. Most QEvents are not gadgets - like QKeyEvent, QMouseEvent, QTouchEvent. We have QQuick*Event QObject wrappers instead to provide access to the low level event data from QML. So, use a single QQuickWheelEvent object instead to pass the data to QML, that class is designed for exactly that prupose. We need to copy the data anyway, and since we don't need to create/destroy the wrapper object for each event, this has no practical overhead. Extend the QQuickWheelEvent to provide access to the phase information of QWheelEvent as well, and simplify the reset() method. Note: making the QQuickWheelEvent store the QWheelEvent directly would allow passing calls to setAccepted through to the QWheelEvent. That is left for a future cleanup, and another reason for not passing events around as copies. Fixes: QTBUG-89594 Change-Id: Id86a9b30c5a8c7c50091e464e368568a7f5ca2ea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 2b15a1fbe2f26a090f79ab5aa238f375bc67fda3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Flickable: ignore trackpad events with px deltas in disallowed directionShawn Rutledge2021-01-151-5/+18
| | | | | | | | | | | | | | | | | If Flickable.flickDirection == HorizontalFlick, then if the accumulated QWheelEvent::pixelDelta()'s abs(dx) > 2 * abs(dy), clearly the user is trying to scroll horizontally; otherwise, don't accept the event. That way the event is allowed to propagate to a parent Flickable that does allow flicking vertically. Likewise if the nesting is the other way around, only allow the inner vertical Flickable to accept if the flicking is actually vertical. Fixes: QTBUG-57245 Fixes: QTBUG-80236 Change-Id: Ieb0bf9310a67210ce7e9fe7a80c88baef2cc7ede Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit dccd8f0b5ca8f6faefb49718e33f9090243f3202) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Text with ElideRight not being rendered when width goes from 0 to >0Fabian Kosmale2021-01-141-1/+4
| | | | | | | | | | | | | | | | | | | QQuickText attempts to reduce relayouting. However, it was a bit to aggressive in doing that. If only the width changed in a geometrychange, it would not relayout if widthMaximum was true. However, if the width goes from 0 to greater than 0, the value of widthMaximum should have actually been false (but we would only notice this after relayouting). Thus, don't skip relayouting in that case. Amends 56ade46b4234bb828b8e4f9a6bf83b5687bd122e, which fixed the same issue, but for height. Fixes: QTBUG-83408 Fixes: QTBUG-33608 Change-Id: I14b610c703eb0496c71de7b12ad9fcf16842af64 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 127c79fb7fda16b9a48ce8c425d1700d1aa7502d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QQuickShortcut::setContext so re-grab all shortcutsAndreas Buhr2021-01-131-0/+7
| | | | | | | | | | | | | A while ago, QQuickShortcut was extended to not only have a shortcut m_shortcut but in addition a list m_shortcuts. During this extension, the setContext method was missed: Shortcuts in m_shortcuts are not re-grabbed on context change. This patch fixes this. Task-number: QTBUG-88682 Change-Id: Ie73d516f2a325a328b6e975d69490eea29a18401 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 28f515e6334fd1c15a2f7f18de6be7bfe1f9c302) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add links to examples of Qt Quick Particle SystemNico Vertriest2021-01-121-0/+6
| | | | | | | | | | | Doc Using the Qt Quick Particle System did not contain links to examples. Fixes: QTBUG-29378 Change-Id: I82e3a3af4925f7c8e58ce6a5c5af57b854cb9e36 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 24372250debc0a067470392776a178b155cedf3e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: mention that Item's childrenRect property is local to the itemMitch Curtis2021-01-052-0/+76
| | | | | | | | | As opposed to being local to the item's parent. Change-Id: Idcf2cdbedcac24a6890ce761c3f2a23f2c7a8dc4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit a0769549cdb81c7104b60c2a67dfa62e8c42c224) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* doc: explain QQItem event delivery, handlers, setAcceptTouchEvents()Shawn Rutledge2021-01-051-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | We quietly recommended calling setAcceptTouchEvents() in the Qt 5.10 release notes in any Item subclass that wants to receive touch events, and in the docs for setAcceptTouchEvents() itself; but the message about the impending behavior change might not have been obvious enough. In Qt 6 it becomes mandatory, so clearer docs will hopefully help to stave off bogus bug reports. We also never had a great overview of event handling from an Item's perspective; now it's a little better. Followup to ab91e7fa02a562d80fd0747f28a60e00c3b45a01 and a97759a336c597327cb82eebc9f45c793aec32c9 [ChangeLog][QtQuick][QQuickItem] When subclassing QQuickItem, you should call setAcceptTouchEvents(true) if you need the item to receive touch events. It will be required in Qt 6. Task-number: QTBUG-87018 Task-number: QTBUG-87082 Change-Id: I1c7a43979e3665778d61949c9d37c1d085ed594b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 7c648280bb53c4276ba4ae2abf26d070fedde71a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-101-1/+1
| | | | | | | | | | And fix up some incorrect qmake project files Change-Id: Ia6d27ac68195635021fe7c4a5f06386a60f3f323 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit c1c4a874e31ba108a3600fbbb0aee7fc0bf34601) Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Show a tableview even if the syncView has an empty modelAndy Shaw2020-12-091-5/+2
| | | | | | | | | | | By showing the tableview, we can be sure that headerviews will be visible even in the syncView has an empty model. Fixes: QTBUG-87526 Change-Id: I68c8b119122a2d2f88c2afbeb2d6c71a83a3ce33 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 27c254203b3e7dd6d3a4445feb205fbe98c32d30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Kill Flickable's wheel momentum if angleDeltas not multiples of 120Shawn Rutledge2020-12-072-34/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wheel momentum is great on old "clicky" mouse wheels: they feel really clunky without this feature. But it's also terrible on most laptop touchpads. We still aren't generating QWheelEvents with pixel deltas and ScrollPhase on most platforms (still only on macOS); but eventually we should. However, those laptop touchpads tend to generate angleDeltas that are not multiples of 120. Added logging categories qt.quick.flickable qt.quick.flickable.wheel and qt.quick.flickable.velocity. [ChangeLog][QtQuick][Flickable] Flickable now tries to detect whether you're using a "clicky" wheel on a desktop mouse. A laptop trackpad can generate QWheelEvent::angleDelta values that are not multiples of 120; in that case, smooth scrolling with momentum is disabled, to avoid losing control of scrolling. Set the environment variable QT_QUICK_FLICKABLE_WHEEL_MOMENTUM_ENABLED=0 to opt out of the old behavior entirely, or set it to 1 to opt in unconditionally. Task-number: QTBUG-38570 Task-number: QTBUG-56075 Task-number: QTBUG-80720 Task-number: QTBUG-82565 Change-Id: I0da2d31259fa1c79ab217a3fa9e888893fc7b235 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 33c87736db7ec79c89c0497192727697d126628d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid unused parameter in QSGRhiSupport in certain configsLaszlo Agocs2020-12-071-0/+4
| | | | | | | | Fixes: QTBUG-88604 Change-Id: Id84faf648656993777f780e147917151ce05d3e0 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit b0f49c89780c7a1ce90b2c4e161bbba0d0beb868) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Document how to use CMake for Qt QuickKai Koehne2020-12-043-1/+41
| | | | | | | | Task-number: QTBUG-73058 Change-Id: Ie72c1f4331ad05f31d9a646730133c97c4b15790 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit c8b108ca76e29d5c1b55468a9659eef80a6afa86) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add documentation dependency to qtshadertoolsAndreas Buhr2020-12-021-1/+2
| | | | | | | | | | Documentation links to qtshadertools. This patch adds qtshadertools to the dependencies so these links can work. Change-Id: Icb059fd681e7456f3452aeba60287bfa1cc3539e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1ea475099cd20dd57ff2a32bf3a0f9b6218c14ba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Quick: Fortify QQuickApplication ctorUlf Hermann2020-12-021-12/+13
| | | | | | | | | | | If the qApp we have is in fact not a QGuiApplication we cannot connect those signals. The "if (qApp)" was probably supposed to check for this but actually doesn't because qApp is a static_cast. Change-Id: Iaa30e3d56768e97601d51d30500fc3b12d0626a3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 8a555cc22afb93dbe0e0da83f211c6e4f032bd09) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix documentation links to High DPI documentationAndreas Buhr2020-12-011-1/+1
| | | | | | | | | | | | The documentation on High DPI was recently rewritten, renaming several sections. This patch fixes the links which were broken by this change. Task-number: QTBUG-88533 Change-Id: I30c1f801f93773e04f85d7ebb3603fafa8f4f2a0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ff7c11c481a57beeea4be2c6fbe8eea78c7b3de2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Allow parent to filter out-of-bounds synth-mouse for grabbing handlerShawn Rutledge2020-11-302-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider Flickable { Text { TapHandler { gesturePolicy: TapHandler.ReleaseWithinBounds } } } On press, TapHandler gets the exclusive grab. Now drag vertically. The Text is short in stature, so your finger soon strays out of bounds of the Text, likely before you have dragged past the drag threshold. In this case, we want Flickable to continue to filter the move events because of the fact that TapHandler is the grabber. If it was a MouseArea instead of a TapHandler, it already worked that way; so this makes behavior of handlers more consistent with that. More specifically: QQuickPointerTouchEvent::touchEventForItem() now generates a touch event even if the touchpoint is not within the bounds of the given item, but is grabbed by one of that item's handlers. Until now, we had that exception only if it was grabbed by the item itself. tst_FlickableInterop::touchAndDragHandlerOnFlickable now always drags the delegate at index 2 (the third one) from its upper-right corner, upwards and to the left. The first drag goes outside the delegate's bounds, but the Flickable/ListView/TableView filters and takes over anyway (on the next drag), to prove that it is correctly depending on the grab that the TapHandler (or DragHandler) took on press. Fixes: QTBUG-75223 Change-Id: Ie4e22c87be0af9aa3ff0146067b7705949b15c40 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1e1674849a89db54cdbcc4e995300e3ec1624c3a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Accessibility event is sent on item's geometry changePiotr Mikolajczyk2020-11-271-0/+8
| | | | | | | | | | | | | In case of enabled accessibility, whenever the geometry of a QQuickItem changes, accessibility module is notified by a LocationChange event. This enables responding to this by for example moving the accessibility frame on the screen. Task-number: QTBUG-79611 Change-Id: I808e835384ef42bba2e9aabecf4be3cda07859fe Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit def81070668f101e1e2cbb46d586bbab64c8e00f) Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Change QQuickRenderControlPrivate from autotest to private exportLaszlo Agocs2020-11-261-1/+1
| | | | | | | | | | | | | There are legitimate cases for using the private class, the number one case being Design Studio where QQuickRenderControl and QRhi are used together. At the moment things work presumably because only member variables are accessed, and that works even in builds that do not have the member functions exported. Fix this up to be future proof. Change-Id: I054deb31607ca8c95fccb2f5988dde6f0a9c372a Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 718472d8e1e30fe2b0bc0e3b514ea0ed20259737) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Remove version numbers for import statementJerome Pasion2020-11-263-12/+11
| | | | | | | | | | | | -recommend using the import statement without versions for Qt 6.0 -update use of \qml snippet without \QtMinorVersion -some language change to be neutral about versions Task-number: QTBUG-87155 Change-Id: I3ac44f93aab3086c1a49de79ecc677beb4ef9180 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 72746ef0ad69d589de91f43aa2043d6e47745d68) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>