aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
Commit message (Collapse)AuthorAgeFilesLines
* QQuickItemView: register Destroyed listener when storing an itemVolker Hilsheimer5 days1-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends fa8bfd6ed5ec4150cd2b05cd17b199097193fb1b, which added the registration logic to createItem with corresponding removal of destroyed items from the unrequestedItems hash. As we add items to that hash also in createdItem and releaseItem (for items that are scheduled for destruction via deleteLater), make sure we handle the Destroyed change for those as well, and don't remove ourselves as a listener prematurely. However, we need to also explicitly remove the item view as listener from all items when the view gets destroyed, and remove them from the unrequestedItems hash when the itemDestroyed handler gets called. As a drive by, turn the static const constant for change types into a compile time constant. Task-number: QTBUG-142738 Task-number: QTBUG-133256 Task-number: QTBUG-46798 Pick-to: 6.8 Change-Id: I216642dde549079d64917791bd7ba3dfe1d1e132 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit b0b1c1de68a1cc15f6304bb85d0c57a49499f866) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9c3d6b47d962fc58aa9e641dddea8a446eff2a98)
* QuadPath: fix error in contains() for horizontal tangentsEirik Aavitsland7 days1-2/+10
| | | | | | | | | | | | | | | | | | The contains() function counts crossings of a horizontal line with other path elements, increasing or decreasing the winding number depending on the path direction in the crossing point. However, if the tangent was horizontal at the crossing, the direction is ambigious, and the count would sometimes be wrong, leading to wrong function result, and so to wrong shape filling in curve renderer. Fix by checking the sign of the second derivative instead when the tangent (first derivative) is 0. Fixes: QTBUG-147396 Change-Id: I32a44d2ed8051c469d06eef1ee272ef5a8036be9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 2a1a5a6840b50687452e2087116245472c7422dc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 2ba53f1453c01888716234837468b9baba996094)
* Doc: Tag QML overview topics with 'qmltopic' keywordTopi Reinio10 days13-0/+13
| | | | | | | | | | | | | | | | | | | This allows filtering for topics in the online documentation TOC-tree (sidebar) for QML-specific entries. QDoc does this automatically for QML API documentation (e.g. type reference pages), this commit adds the tags for overview pages. Tagged pages include content that have no significant amount of C++ concept documented, but may still link to such pages. Task-number: QTBUG-142011 Task-number: QTBUG-141035 Change-Id: I6b9f78f325c050744539729675a5a8d624b7ef77 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> (cherry picked from commit 325d7dd75550f9e38a8334156e096a015be8614a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit ebbba3be70c6bbf3e6ef23b85d5c8792f60a90ab)
* QQuickText: fix StyledText paragraph direction detection with tagsVladimir Belyavsky11 days1-12/+8
| | | | | | | | | | | | | | | | | | | | | When textFormat is Text.StyledText, the paragraph direction was detected from the raw markup string via text.isRightToLeft(). HTML tags like <span> or <b> contain Latin characters that cause the detection to incorrectly classify RTL content as LTR. Fix by moving direction detection for non-rich text into updateLayout(), where the layout text is already available: either from QQuickStyledText::parse() (stripped of markup) or from the plain text path. This also avoids emitting effectiveHorizontalAlignmentChanged with a wrong intermediate value when styled RTL text replaces other RTL text. Fixes: QTBUG-147277 Change-Id: I0256c1759d242349bcf047b1b0b37e9da35c5fab Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit b66eb296c2fa10756084c7ca1ee593e298cc2945) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 693239a08f3bda3c58388d5c00f6edd413da1c70) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Move the svgtoqml tool docs to the Qt Quick documentationAlexei Cazacov2026-06-082-0/+106
| | | | | | | | | | | | | | The svgtoqml tool is semantically closer to Qt Quick rather than QML, so the docs are moved to the Qt Quick section. The tool code is still available in the same location in the source tree, so no code changes are needed. Task-number: QTBUG-146857 Change-Id: I406f28c87bf2d3b31b3d469d3d4be7e35dfc1ea7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 3b852d32ef4571678eca211409e63a4ae0da822b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 5b9ebff63c4ae038fe7900a932eec17c4f746e09)
* grabToImage: improve invalid dimension warningMitch Curtis2026-06-041-2/+2
| | | | | | | | | | Explain why it's invalid and print the actual dimensions. Change-Id: Id585f6aafb3cb49e321f3e239fc726a749608021 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 6cd1520263553d3951a7271b33ff28fdba7005d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 06d553ed96968aaf5ab400e4484c0ced13b0a512)
* QQuickText: iterate over a const QList to avoid detachesVolker Hilsheimer2026-06-031-1/+2
| | | | | | | | | | | | | | | Make sure we iterate over a const QList to avoid detaches. Amends 3f4088256c7712cbc757dd4d8835a3d4b272b4ee. Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3127 Pick-to: 6.8 Task-number: QTBUG-146041 Change-Id: I549f5b6f36b18e62619d5ad6e2b3f8305d177cb6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 684e4c22533e1af417fc2b6859b9e96405cfc679) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 210e4fd45ab0ad862b43ab12746e6077339d90a1)
* QQuickText: don't assign a QList::iterator to a const_iteratorVolker Hilsheimer2026-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | In the first case we don't have to as we return immediately anyway. The detach in that loop is the exception (only the error-handling path modifies the list), so iterating using const iterators avoids the detach overhead. In the second case, the list is typically modified (error handling path does not, but at least one download is likely completed when this function gets called), so we might just as well use mutating iterators. Silences static analyser warnings. Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1452 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1453 Pick-to: 6.8 Task-number: QTBUG-146041 Change-Id: Ieda0bc79b0292c95b364e13cbb9c6b81bad8ff1a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit d2f63aaaa03a7bf271aba7471f4a18f9e20ecbf7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Guard against nullptr in QQuickAccessibleAttached::labelFor/labelledByOliver Eftevaag2026-05-301-2/+13
| | | | | | | | | | | | | Otherwise, passing nullptr to the function may crash the application. Add a test, that verifies that passing nullptr doesn't crash. Fixes: QTBUG-146127 Pick-to: 6.8 Change-Id: Ib9b3515cb77ccd9f28f3e40da87703b10791795e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit c951c4d595be5cbaf9ce094f13ff1b232e1947d3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTextEdit: update cursorDelegate and repaint on alignment changeVladimir Belyavsky2026-05-291-0/+5
| | | | | | | | | | | | | | | | | | | setHAlign() did not call moveCursorDelegate(), so a custom cursorDelegate would stay at its old position when horizontal alignment changed. setVAlign() and resetHAlign() did not call updateWholeDocument(), so the text content was not visually repainted when vertical alignment changed. Add the missing calls following the pattern already used in geometryChange(). Also add a test that verifies cursorDelegate position is updated after both horizontal and vertical alignment changes. Fixes: QTBUG-140453 Change-Id: I3bccc7590233ffd5552c6873c920d7eeb3afc2d7 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 3eee54e4910fb483c01493fa00969f5a0b844c0a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtQuick: Don't crash when trying to reset a nullptr paletteUlf Hermann2026-05-181-1/+2
| | | | | | | | | | | | | | If the palette doesn't exist, it doesn't hold any data, and resetting it is a noop. No need to crash then. The RESET accessor for palette is exposed via QML, which makes it easy to trigger this. Pick-to: 6.8 Change-Id: I6aaf8db0bceddd69d6e996e478a400a2a90efb66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> (cherry picked from commit 5e8b586b985ed28282454a8103698b905ae70a75) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TextEdit: don't extend anchor underline through tab charactersRaman Shamotsin2026-05-181-2/+9
| | | | | | | | | | | | | | | | | | | | | Tab characters do not produce glyph runs (they are skipped in QTextLine::glyphRuns()). When QQuickTextNodeEngine::processCurrentLine() iterates glyph run nodes to draw text decorations, it unconditionally extends the decoration rect from the last decorated node to the left edge of the next node. Since the tab has no glyph run of its own, the underline from an anchor is extended across the entire tab gap to the next visible glyph run, even though that run is outside the anchor. Fix this by only extending the decoration rect to the next node when the next node continues the same decoration, or when it is directly adjacent (no gap). This preserves underline through tabs inside an anchor while preventing it from bleeding through tabs outside. Fixes: QTBUG-146648 Change-Id: Icf8dc088dfb021e928b25ba07de3d57331e55ff8 Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> (cherry picked from commit 879eee28f7578462680c8fc66f30463af0053fd5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtQuick: Avoid passing NaN through to QColor methodsUlf Hermann2026-05-181-0/+10
| | | | | | | | | | | | | | | Check for NaN before rounding for lighter() and darker(). qRound() asserts on NaN. Also guard Color.blend() against NaN factor. Check that QColor catches invalid values we might throw at it and that we don't have to range-check them ourselves. Pick-to: 6.8 Fixes: QTBUG-145030 Change-Id: Ia8a3f22956a6ff5e2298d88a262f7cb6da29e61d Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 60b7e25fbbc3b62dffb12d3043557c100c1ad443) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuadPath: fix UB (data race) in qt_scoreQuadratic()Marc Mutz2026-05-141-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code populated two qreal arrays at runtime, lazily on first use. To detect first use, it used a plain bool variable, `init`. Due to lack of synchronization, the accesses to `init` as well as those into the two arrays constitute data races (this class is unlikely to be confined to just the GUI thread, given Quick's use of a separate thread for rendering): One thread could see init == true while it still sees the arrays of having 0.0 entries. This is UB. There are three possible solutions to this problem: 1. keep the general structure with the init flag, but make the flag an atomic and use a mutex to implement double-checked locking 2. factor the code into a struct with constructor and use C++11 magic (= thread-safe) statics 3. calculate the tables at compile-time This patch implements (3), for two reasons: - the old code didn't lock; use of a mutex (either explicitly as in (1) or implicitly as in (2) would introduce blocking, and this author isn't sure whether that would break something - compile-time calculations don't cost run time The TEXT size grows by 144B on optimized Clang 21 Linux AMD64 C++26 builds, but the run time savings remain, of course, as does this data race fix. I didn't experiment with the other two solutions. As a drive-by, use static_assert-with-text instead of Q_STATIC_ASSERT() with a comment, fixing a typo. If you are wondering why I touched numSteps at all: First, I needed to make it constexpr, not just const, and, second, I moved its definition into the lamda because compilers differ in how they treat capturing of constexpr automatic variables: AFAICT, C++ doesn't require them to be captured at all, but some compiler warn if you don't, while others warn if you do. And you can't use [&], because then some compilers warn if that captures nothing at all. Amends ec6c05f4ce5763ae85c1e9f7fb50c4f593709cc9 (picked to 6.6). Pick-to: 6.8 Change-Id: Id8fb3d89ada8ff54c75ce36fa76daf86c0110e34 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 07559c43db83d946aea3ab66dd683d073b062b55) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSGCurveProcessor: fix potential ODR violation: qHash(QVector2D)Marc Mutz2026-05-131-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtDeclarative doesn't own QVector2D, so it MUST NOT define a qHash() for it. There's also a qHash(QVector3D) in the Quick3D assimp code, so apparently there's a need for hashing QVectorND, which makes it even more likely that users will do the same. And if they do, and the implementation isn't token-by-token identical to the one in QSGCurveProcessor, then that's an ODR violation. This is not theoretical: both the implementation in the assimp code as well as the one I will use in qvectornd.h are different from this function here, so if a user is defining their own, it very likely differs, too, incl. yielding differing hash values for equal elements. If the linker picks one TU's insertion and the other one's extraction code for the final binary, they will not find each other's entries. The eventual fix for this will be to define qHash() functions for the QVectorNDs in qvectornd.h itself, but until then, we need to fix the potential ODR violation. To do that, wrap the QVector2D in a small wrapper template and define qHash() on _that_ instead. Amends cc04afbb382fd4b1f65173d71f44d3372c47b0e1 (6.8). Pick-to: 6.8 Change-Id: I96e9cb7da2019b4b0557c79c372296fa15506849 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit eaaed962e337598fa9cfdcc7eb2ee5fb20024e46) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlTableInstanceModel: refactor QModelIndex calculation out of QQuickTableViewRichard Moe Gustavsen2026-05-111-9/+1
| | | | | | | | | | | | | The QQmlTableInstanceModel can derive the QModelIndex itself from the flat index, so there is no need for a separate object(QModelIndex) overload. Amends de4b7283c978ca384f6c8bf9f27387158804b601 Change-Id: I9dfff8026ef0acca660f1211b0e453c46562985f Reviewed-by: SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io> (cherry picked from commit e635da3faf6dac654b2591204162a217a6f02766) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickDrag: fix binding loop and re-entrancy for Automatic drag typeShawn Rutledge2026-05-062-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Drag.dragType is Automatic and Drag.active is bound to e.g. DragHandler.active, calling setActive(true) previously invoked startDrag() immediately, which in turn called QDrag::exec(). That exec() call enters a nested event loop, which is incompatible with being called from within a QML binding or JS expression: the QML engine is still mid-evaluation when exec() blocks, so when the pointer release arrives in the nested loop, deactivates the DragHandler, and causes the binding to re-trigger, the engine detects a binding loop. Fix this by deferring the startDrag() call via Qt::QueuedConnection so that the current JS frame unwinds completely before exec() runs from a clean event-loop context. An 'if (d->active)' guard in the deferred lambda handles the case where the drag is cancelled before the queued call fires. The executingNativeDrag flag is now set/cleared around exec() inside startDrag() itself (covering both the Automatic binding path and direct QML calls to Drag.startDrag()). It suppresses re-entrant setActive(false) calls that arrive via DragHandler deactivation while exec() is blocking, since startDrag() already handles all cleanup when exec() returns. Fixes: QTBUG-144006 Change-Id: I9bf6a4e6f3edea7e12e187b5756ab483c462696a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Konsta Alajärvi <konsta.alajarvi@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit ae6e67e4cf23af6dbceab5e62881864b3a38c867) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Silence some static code checker complaints in qsg*Laszlo Agocs2026-05-066-11/+12
| | | | | | | | | | | | | | | | | | | | | Pick-to: 6.8 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1543 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1544 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1549 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1741 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV1803 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3062 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3128 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3129 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3130 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3134 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3135 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3136 Axivion-Id: qt_Essentials_qtquick_dev_linux:SV3137 Change-Id: I4427a85cfa6050d43ccd74bd354af3301c802151 Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit c570680474bcd5f098e1fda4c05bb46885e5bc3a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickTableView: respect QAIM::buddy() when editing cellsRichard Moe Gustavsen2026-05-061-8/+26
| | | | | | | | | | | | | | | | | | | When edit() is called, consult QAbstractItemModel::buddy() first to resolve the target index. This allows the model to redirect editing to a sibling cell, matching the behavior of other Qt item views like QTreeView and QTableView. The included test verifies that we now respect the buddy. The checkEditAfterReorder() test also had to be modifed slightly. It assigned a QVariant(QSharedPointer(QAIM)) as model to TableView, and not the expected QVariant(QAIM). This strangly works in most cases, but will now cause a warning in canEdit() since the variant cannot be casted directly to a QAIM. Change-Id: I01092228019c91212c601f104f5f2fa3274e74e0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b2af284eac4aa0e936c42c4c62a9fe14c9ab6916) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* ListView: preserve visible item on SnapOneItem resizeEvgen Pervenenka2026-05-011-2/+33
| | | | | | | | | | | | | | | | | | | | | | When delegates are sized relative to the view (e.g. height: ListView.view.height), resizing changes all delegate positions. The content position becomes stale, and fixup() calls snapItemAt() with that stale position, snapping to the wrong item. Record the currently snapped item in geometryChange() before layout runs. In fixup(), use the saved index to override the snapItemAt() result, so the correct item is picked with all existing header, highlight, bounds and animation logic preserved. The hint is reset in fixupPosition() after the fixup pass completes. StrictlyEnforceRange is excluded because its fixup() path already forces currentItem as the snap target. Fixes: QTBUG-112349 Fixes: QTBUG-44449 Change-Id: Ie766a4d8641bd2410116c468afc27c8bc25b9f16 Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> (cherry picked from commit 8a99e83213c674ac2946ded86b1aec70c5af63f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Add Android Fragments with Qt Quick for Android to the TOC treeAlexei Cazacov2026-04-301-0/+1
| | | | | | | | Change-Id: I6f674f31fa361c0dc6141c9e439147f846610219 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit c39322626ec2ca05409d18c35a6e8af5e3f86b54) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix positionViewAtBeginning() when item 0 is outside the cache bufferMorten Sørvig2026-04-281-1/+21
| | | | | | | | | | | | | | | | | | | | | positionAt(0) can make inaccurate estimates in cases where the target element is outside the cache buffer, and the list contains section headers. However, since the beginning is a well-known position we can just scroll directly to that position instead. If we do, markExtentsDirty after clearing the visibleItems, to prevent an issue that could occur when setPosition(0) gets called with a stale extent. the extent must be recalculated, in order to be precise, and take into account if the first item has a section or not. Fixes: QTBUG-132694 Change-Id: I51e0634e685d56d1ab341c31f79a8e89cfa6f5c0 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 9111e967bf54e8fc6644727d334ebfdaf3b59a28) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port away from contextless 3-arg QObject::connectAhmad Samir2026-04-281-1/+1
| | | | | | | | | | | Task-number: QTBUG-116296 Fixes: QTBUG-145828 Change-Id: Ibef2895a408e6a21659825e185885085ef6ca70c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 2837fa1b31f735fb22c5eea84787e59195071a5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickDeliveryAgent: fix 3-arg connect()Marc Mutz2026-04-281-1/+1
| | | | | | | | | | | | | | | Use the source object as the context object, since the lambda is only interacting with the source object. Amends 68c103225f4e8bd6c1b18ef547108fd60f398c0f (6.2), which, however, just moved this code from another file. Pick-to: 6.8 Task-number: QTBUG-145828 Change-Id: I63e2025ae31913f121f3a65fc8e735c1e6bedbf3 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit b0d1ed208d71ca50f32fe72aa8ca1f8fb80fbb23) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickDesignerCustomObjectData: fix 3-arg connectMarc Mutz2026-04-281-3/+2
| | | | | | | | | | | | | | | | Use the source object as the context object, since `this` is not a QObject. As a drive-by, pass HandleDestroyedFunctor as an rvalue. Amends 537172dc9f76fa08e995042021f620cef7bd4929 (5.6). Pick-to: 6.8 Task-number: QTBUG-145828 Change-Id: I61bd6faed425097b95da74045109e731f7808165 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit fa20148237a172f0f08eb031df7c5d2cfd41235e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TableView: avoid unnecessary pooling on row/column insertion and removalRichard Moe Gustavsen2026-04-254-62/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a ViewportOnly rebuild is triggered in TableView by a row or column insertion or removal, delegate items that survive the operation (i.e. are not part of the removed range) should not be pooled and reused. Instead they should simply stay in place and have their context properties updated to reflect any shift in flat index, row or column. This avoids a full pool cycle, preserves any ongoing visual state such as animations, and suppresses unnecessary pooled/reused signals. To achieve this, released items are now staged in a temporary m_releasedItems cache rather than moved directly to the reuse pool. During the rebuild, resolveModelItem() first searches the cache for an item whose QPersistentModelIndex matches the requested cell. If found, the item is reclaimed directly. Once the rebuild is complete, commitReleasedItems() transfers any remaining cached items (those whose cells genuinely disappeared) to the reuse pool, like before. In order to achieve this, a new QPersistentModelIndex is stored on each delegate item. That way we know which cell it originally belonged to, even after changes to the model shifted its row and column position. A new auto-test, verifyThatOnlyRemovedRowsArePooled, is included that verifies the new expected behaviour. The changes in this patch also uncovered that the test model used throughout in the test file was implemented with too many assumptions, and therefore needed some TLC. Fixes: QTBUG-116650 Fixes: QTBUG-134741 Change-Id: I0b935320b6e7dca215df438f5981a154a8c10385 Reviewed-by: SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io> (cherry picked from commit de4b7283c978ca384f6c8bf9f27387158804b601) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickWidget: Fix tab fence focus cyclingOliver Eftevaag2026-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a QQuickPopup is open inside a QQuickWidget, pressing Tab on the last focusable item in the popup would move keyboard focus to a widget outside the QQuickWidget instead of cycling back to the first item in the popup. QQuickItem::nextPrevItemInTabFocusChain() has a parameter `warp` which is used by QQuickWidgets and embedded windows. To prevent wrapping between the first and last focusable items in the QML scene. This was working as intentional, with the exception that it would ignore cases when the current focused item is inside a tab fence. In such cases, we still want the item to wrap, we just want it to wrap inside the tab fence, which nextPrevItemInTabFocusChain() already takes into consideration, as long as we don't return early when wrap=false. Fix it by only returning early from wrap=false, when not inside a tab fence. Fixes: QTBUG-138101 Pick-to: 6.10 6.8 Change-Id: Iab0914161f0a80c3b0df0385cfb1fd0c0027ac7a Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 77c3189bc00ebd302b5a211d039db49228dca105) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickText: fix inflated implicitWidth with maximumLineCountVladimir Belyavsky2026-04-231-2/+10
| | | | | | | | | | | | | | | | | | | | | | | When a Text element uses StyledText with <br> tags, maximumLineCount, wrapMode: Wrap, and elide: ElideRight, constraining its width could cause implicitWidth to grow far beyond the correct value. The root cause is twofold: 1. The loop that creates unwrapped lines for implicit width calculation used '<=' instead of '<', causing one extra line to be created and finalized beyond maximumLineCount paragraphs. 2. The multiline-elide code path creates a trailing line via createLine() to compute the elided text. That line is left unfinalized, so endLayout() finalizes it at QFIXED_MAX width, inflating maximumWidth(). Finalize it at zero width right after use. Fixes: QTBUG-142933 Change-Id: I64bab9512b8400ed63a4dda709259488a2b49a21 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 021778a0ad7d5758cee5f5592017e46b4e12171d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QQuickPath::isClosed() to return false for empty pathsDheerendra Purohit2026-04-231-0/+2
| | | | | | | | | | | | Return false when path has no elements in QQuickPath::isClosed(). This makes ShapePath and Path behavior consistent for empty paths. Pick-to: 6.10 6.8 Fixes: QTBUG-90451 Change-Id: I8c6f2049ce85ec13d5f6b798356bac48db9ad558 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 242ada348a9176c1340cd630049356820a35d8dc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItemGrabResult: fix potential data racesIvan Solovev2026-04-221-5/+29
| | | | | | | | | | | | | | | | | | | | | The class' setup() and render() methods are always executed on the renderer thread, while all other methods are executed on the main thread (or any other user thread). That way, we have a potential race condition when accessing the members of QQuickItemGrabResultPrivate. Fix it by adding a mutex. Note that we cannot hold a mutex when executing a callback or emitting a signal, because this can lead to a deadlock is the slot or a callback use the getters. Extend the existing test cases to cover these scenarios. Pick-to: 6.8 Change-Id: I03cc556975f783c630f29ec648306f3cd604ed16 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 055e06e435ee227e79239548d2873b1bcc32ecc2) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickItemGrabResult: fix potential use-after-freeIvan Solovev2026-04-221-11/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the QQuickItem::grabToImage() overloads returns a QSharedPointer holding the QQuickItemGrabResult. However, that pointer was never stored anywhere internally. As a result, we could end up in a situation when the user code deletes the provided pointer at the same time when the renderer thread accesses it in QQuickItemGrabResult::setup() or QQuickItemGrabResult::render(). Fix it by using lambdas when connecting to the window's beforeSynchronizing and afterRendering signals and explicitly capturing a weak pointer that refers to the shared pointer in that lambdas. That also requires to store the connection handles, so that we could properly disconnect(). Fixing the problem revealed one more issue: the pointer that is not managed by the smart pointer, was still parented to a QQuickItem. That could lead to double-free or raise an assertion QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread" when deleting the QQuickItemGrabResult from the renderer thread. Fix it by resetting the parent to nullptr after the ownership is transferred to the smart pointer. Note that the other overload of QQuickItem::grabToImage() is not affected, because the pointer is never exposed to the client code directly. Note: while investigating, it became obvious that the implementation also has race conditions, because setup() and render() are always called from the renderer thread, while all other methods are called from the main thread (or any other user-specified thread). This will be addressed in a follow-up change. Fixes: QTBUG-138207 Pick-to: 6.8 Change-Id: I76675b7f07e92cf3c7fbad7c431fab790d91a907 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 2e08ac5d80f4964bda6ab604e15445f0e036b61d) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* TapHandler: keep accepted=true for mouse with DragThreshold policyShawn Rutledge2026-04-221-24/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Reverts the 8bc7c745a4b9ac50392329bc1cec0b1d0e3e34f0 TapHandler change to avoid breaking cases with a TapHandler in a child item, but keeps the touch-specific test. The mouse part of the test is expected to fail for now. Restores the isTouch guard so that TapHandler with DragThreshold policy only resets point.accepted=false for touch. For mouse, leaving accepted=true causes deliverPressOrReleaseEvent() to set handlersOnly=true, which prevents sibling items with MouseArea from also receiving the press. If you drag the mouse over a TapHandler that is above a Flickable as a sibling, the Flickable doesn't scroll; but doing it with the touchscreen works, as before. This is inconsistent, but doesn't seem easily fixable for now; perhaps it would help to get Flickable to use a passive grab instead of child-event filtering, perhaps via an internal handler. But that's a major change. Fixes: QTBUG-145896 Change-Id: If09a9221c5616e4106de406e9ac20791a46e9c87 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit f2222fb64b7ffe224578810e6221c61d4473aedb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItem: don't access a destroyed public object from the privateVolker Hilsheimer2026-04-201-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | QQuickItemPrivate::effectiveAccessibleRole might get called by the a11y bridge when ~QQuickItem raises QAccessible::ObjectHide/Destroy events. At this point, the private object is still fully constructed, but the public is obviously already half-destroyed. As effectiveAccessibleRole accesses the q-pointer (i.e. the pointer to that half-destroyed object) to call virtual functions on it, we need to guard this code with a check whether that public object is already under destruction. The private's inDestructor member gives us this information. If set, just return the default value. This has the downside that the a11y layer won't get the right role information about this object anymore, but better to be wrong than to crash. Pick-to: 6.8 Fixes: QTBUG-144331 Change-Id: I28234c03d403f3da5d75e3d76aae1981d9354181 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit c58ff1e6d48e49475b54ba69214fa3e9776f8b3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Docs: replace ambiguous 'object' with specific QML typesShyamnath Premnadh2026-04-203-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace ambiguous `object` qdoc annotations with `var`, `QtObject` or concrete QML types to make API intent clear and improve tooling. Affected signatures (old → new): - ListModel::get(int index) — object → var - ObjectModel::get(int index) — object → QtObject - DelegateModelGroup::get(int index) — object → var - Component::incubateObject(QtObject parent, object properties, enumeration mode) → var Component::incubateObject(QtObject parent, var properties, enumeration mode) - Component::createObject(QtObject parent, object properties) → QtObject Component::createObject(QtObject parent, var properties) - Qt::createQmlObject(string qml, object parent, url url) → QtObject Qt::createQmlObject(string qml, QtObject parent, url url) - Qt::include(string url) — return object → var - Qt::platform (qmlproperty) — object → var - Qt::styleHints (qmlproperty) — object → QtObject - Qt::font(object fontSpecifier) → font Qt::font(var fontSpecifier) - Canvas::getContext(...) — object → Context2D - Context2D chain-style methods (save, restore, translate, rotate, scale, setTransform, transform, moveTo, lineTo, arc, bezierCurveTo, quadraticCurveTo, rect, roundedRect, ellipse, fill, stroke, fillText, strokeText, etc.) — object → Context2D - createLinearGradient/createRadialGradient/createConicalGradient — object → CanvasGradient - isPointInPath(...) — object → bool - measureText(...) — object → var - putImageData(...) — object → void - CanvasImageData::data — object → CanvasPixelArray - Loader::setSource(url, object) → void Loader::setSource(url, var) - TestCase::grabImage(Item) — object → QtObject - TestCase::createTemporaryQmlObject(string qml, object parent, string filePath) → QtObject createTemporaryQmlObject(string qml, QtObject parent, string filePath) - TestCase::createTemporaryObject(Component component, object parent, object properties) → QtObject createTemporaryObject(Component component, QtObject parent, var properties) Determined correct types by inspecting the corresponding C++ implementations (return/parameter types) and native types of the QML types. QObject -> QtObject, QJSValue becomes var mostly. Fixes: QTBUG-141127 Pick-to: 6.8 Change-Id: I27eda37c1bff6e9625d14b07668287402ef85e11 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 573aa2a580d12392478711594a9dcf5cf7781bb4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add QML API documentation for InputMethodNicolas Fella2026-04-201-1/+140
| | | | | | | | | | | | | Currently the type shows up in the documentation, but all the content is missing. Copy over the documentation from QInputMethod Fixes: QTBUG-144447 Change-Id: I51de65cec60bfebbd947e900a1f8ddd3c09221ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 1d646455ec5a1fffc8c0dbd2545326fc039b6fda) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Text::truncated property when assinging empty textJoni Poikelin2026-04-201-0/+4
| | | | | | | | | Fixes: QTBUG-143872 Pick-to: 6.10 6.8 Change-Id: I92745cc3e26667f82801349cc00d5b060bce9c8d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 4ce7046ca71c802f791dc500236df13828fcb16f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Include what you use: QTypeRevisionMarc Mutz2026-04-172-0/+3
| | | | | | | | | | | | | | | | | These files use QTypeRevision in-size, but relied on transitive includes. Add the include. Some _p.h files use the type in-name-only, so only add a forward declaration there. Amends 789929f939a60462373beae37ab4373809095cff (6.0), which introduced QTypeRevision into QtDeclarative for the first time. Pick-to: 6.8 6.5 Change-Id: I2ebd0d6dd3f193921a14b032e92bf5f91ed06331 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 9f80908f690bb5e820c7ccbd4bd69b70aa7d567c) Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QQuickItem: don't pass a QByteArrayLiteral to a const char*Marc Mutz2026-04-171-1/+1
| | | | | | | | | | | | | | | | Pass the C string literal directly. Found by QT_NO_CAST_FROM_BYTEARRAY. Amends bf74a908cb0591c2adc024a6f93d566c7348c125 (5.11). Pick-to: 6.8 Task-number: QTBUG-145829 Change-Id: I9f7b59c223eef66a367ab7cf184240cfd4b4c1fe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> (cherry picked from commit 954e7c13c59bbe46455665839e63206d031c2a35) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Enable Flickable dragging via mouse under an item with a TapHandlerShawn Rutledge2026-04-171-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the isTouch && guard in QQuickTapHandler::handleEventPoint, so that TapHandler with DragThreshold policy resets point.accepted=false for both touch and mouse. Root cause: 1) deliverPressOrReleaseEvent iterates targetItems = [overlayRect, Flickable] 2) After delivering to overlayRect, TapHandler's wantsPointerEvent calls chosen->setAccepted() — setting the point's per-point accepted state to true 3) For touch: TapHandler's handleEventPoint reset this to false (the old isTouch guard) → allPointsAccepted() = false → handlersOnly stays false → Flickable gets its touch event ✓ 4) For mouse: no reset → allPointsAccepted() = true → handlersOnly = true → deliverMatchingPointsToItem returns early at the if (handlersOnly) return check → Flickable's mousePressEvent never called → no exclusive grab → no dragging ✗ 5) With the fix, mouse now behaves like touch: point is reset to accepted=false, handlersOnly stays false, Flickable gets its mousePressEvent, takes the exclusive grab, and dragging works. Additionally, a crash began to occur in tst_flickableinterop due to a dangling connection to a lambda in tst_FlickableInterop::pinchHandlerOnFlickable(). Thanks Claude for troubleshooting that. Fixes: QTBUG-126812 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Change-Id: I8b33f766974497564b9ab427e29d80f4e487f231 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 8bc7c745a4b9ac50392329bc1cec0b1d0e3e34f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Flickable: setKeepMouseGrab/setKeepTouchGrab as appropriateShawn Rutledge2026-04-174-52/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a scenario in which the parent of a Flickable has a DragHandler with a larger dragThreshold set, DragHandler already honored the keepMouseGrab flag. I.e. if you are dragging across the Flickable via mouse, at the time DragHandler tries to start dragging, the Flickable already has a grab because its drag threshold was exceeded earlier, and it has called setKeepMouseGrab. So DragHandler does not steal the grab. Now if we repeat the same test on a touchscreen, it was behaving differently: Flickable was not setting setKeepTouchGrab, and DragHandler does not check setKeepMouseGrab, because it's attempting to grab a touchpoint, not the mouse. So we make it consistent by calling setKeepTouchGrab when the event is a touch event. The old stealMouse flag now means steal the exclusive grab of the eventpoint from the mouse or touch event, whichever we're using; so it's now renamed to stealGrab. In a scenario in which a handler is a child of something inside Flickable though (for example using a DragHandler-implemented Slider in an itemview delegate), it's allowed to steal the grab, as before. But disallow grab transfer from a keepGrab item to an unrelated filtering parent. Flickable::filterPointerEvent: the early return when Flickable already has exclusive grab was returning true (event filtered), which caused deliverToPassiveGrabbers to mark the event as alreadyFiltered and skip calling passive-grab handlers (TapHandler, DragHandler). This meant TapHandler never received the over-threshold move, and stayed pressed. Now we return false instead, so passive grabbers still receive events. approveGrabTransition(): the exception that lets handlers inside a Flickable steal from Flickable checked filtersChildMouseEvents(), which is temporarily set to false by QQuickTableViewResizeHandler during a resize drag setup. This blocked the ResizeHandler from stealing back. Also, native mouse events were not covered (only touch-as-mouse was). Fix: check isAncestorOf(parentItem()) unconditionally — a handler that is geometrically inside an ancestor item should always be permitted to take the grab from that ancestor. Extend the inner condition to also allow native mouse events (isMouseEvent), not just touch-as-mouse. Amends d7623d79ef4bc9533fced027bf1d173d68b4eba6 etc. Amends 5171bcd9ce99e794c1091069810314fb5457703b : the "multi-touch is probably meant for some child" heuristic is changed. Fixes: QTBUG-75074 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Change-Id: Id861816ed3c6acd4cc840dabfeeb4cb88705b55c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 3fd2ee9231621313773142d271d24843430c38ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Handle Tablet events in QQuickOverlay and QQuickPopupKonsta Alajärvi2026-04-151-0/+14
| | | | | | | | | | | | | | | | | Currently tablet events are not handled in qquickpopup and qquickoverlay at all which leads to tablet events propagating through modal popups. Handle tablet events similarly as wheel events in qquickoverlay and qquickpopup. Fixes: QTBUG-135879 Pick-to: 6.8 Change-Id: If1a3f4329f3bc2040652ea42eb86126001c2dec9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ffcf191bb6400a7c978dc12b7b2315c839ac59d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItem: avoid virtual calls in dtorAnton Kudryavtsev2026-04-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | Violates rule OOP50-CPP of the SEI Cert C++ Coding Standard. (https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP50-CPP.+Do+not+invoke+virtual+functions+from+constructors+or+destructors) I'm not 100% sure of the code path, but stack trace of attached bug looks like: QQuickItem::~QQuickItem -> QuickItem::setParentItem -> QQuickItemPrivate::setEffectiveVisibleRecur -> QAccessible::updateAccessibility -> QCocoaAccessibility::notifyAccessibilityUpdate -> QAccessibleQuickItem::interface_cast -> QAccessibleQuickItem::role() -> QQuickItemPrivate::effectiveAccessibleRole -> QQuickItemPrivate::accessibleRole -> QQuickControlPrivate::accessibleRole -> QQuickControl::accessibleRole After we have sent ObjectDestroyed, it doesn't make sense to send further a11y events, so we can just set isAccessible = false and don't trigger a11y anymore in dtor. Fixes: QTBUG-139107 Change-Id: If3615693b07fea77bbda3fb9180252a7ac1f61b2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit 3c70e7fa7db4fc3b255bfc9eab69aa14aac7fd8f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TableView: optimize selection fragmentationVolker Hilsheimer2026-04-151-20/+29
| | | | | | | | | | | | | | | | If neither columns nor rows are swapped, neither in this table view nor in the linked syncView, then we can interpret the span of indexes as a contiguous block, and don't have to select/deselect each individual index separately. Move the repeated logic into a local lambda. Exit early if the new selection is the same as the old. Fixes: QTBUG-145070 Change-Id: Ifbc30c8c096e0b3235900ea64a9f379f329b3bb5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 4ad14055573e8dbc993c1a52f199b14ab765f519) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* TableView: use dedicated lists for visual/logical index mappingVolker Hilsheimer2026-04-152-60/+71
| | | | | | | | | | | | | | | | | | | | | | | | | The code accessing an array by literal index to distinguish horizontal and vertical mapping was hard to follow. Instead of using C arrays of two lists, use two lists with explicit naming, and since we never need to copy those lists, use std::vector so that we don't pay the overhead for reference counting and testing for detaches in performance critical code. Add a mapping helper that returns a reference to the correct vector for a given orientation. As a drive-by, fix the signature of helpers that operate only on one of the two orientation so that they take a specific value rather than the flags Qt::Orientations type. Clean up the relevant code: don't access a list's raw data array just to access an element by index. Task-number: QTBUG-145070 Change-Id: I4365d058f550206b9d3c19b6ab98f8648b8a47bc Reviewed-by: SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io> (cherry picked from commit 9f0725079f26d30ce9e7d73c11aa355af1fc2b8e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PointerHandler::resetCursorShape(): reset hasCursorHandler conditionallyShawn Rutledge2026-04-151-2/+15
| | | | | | | | | | | One item may have two handlers, both trying to set the cursor; if only one of them changes, the item's hasCursorHandler should not be reset without checking the other handler. Change-Id: Ia8148e5d12e8cfd7ea2ecf9d2b03952e92699be1 Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> (cherry picked from commit 709a6d309be6dd5075b7ea0ad2cf77f19dc32bff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickShaderEffect: use QObject_Private_::connect()Marc Mutz2026-04-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code fought hard with the impedance mismatch of using QObject::connect() to connect to what previously would have been called a Q_PRIVATE_SLOT. This is what QObjectPrivate::connect() was invented for, so use that. Now the receiver context object is correct, too, and not the sender as an alibi context. Amends 1f9ae93ccfb267e1d0a2e5056b7ddb48cb0b535c (6.5). Note that the changed context object may change the connection from a direct to a queued now. Most likely, both objects live on the same thread, but just in case they don't: sourceDestroyed() is most certainly not thread-safe, so this would fix UB. Again, I don't expect that; just saying the new code is more robust than the old in that regard. Not picking back to 6.5, since this doesn't seem to fit the criteria for an ESM branch. Pick-to: 6.10 6.8 Change-Id: Ifcee1f9ef0320c4db0fa2fff1332c10c5f742e63 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a3d3af442b850466ab84a32fe694fe2e0eb1d2b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickShaderEffect: simplify disconnecting out of m_destroyedConnectionsMarc Mutz2026-04-141-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The old code used find() + erase(), in four LOC. But we can just use take(), because disconnecting from a default-constructed Connection is a no-op. Technically speaking, this changes the sequence of operations: before, it would first disconnect() and then erase(), now it first erases and then disconnects. The new way is safer, because it doesn't leave (albeit briefly) an invalid Connection in the QHash, which may cause false positives if e.g. contains() was used to check whether a given QQuickItem* was still connected. I'm not saying there is such code, just that take() is in general more robust. This, as a drive-by, also avoids passing a const object to disconnect(), which is going to be deprecated since the function modifies its argument. Amends 1f9ae93ccfb267e1d0a2e5056b7ddb48cb0b535c (6.5). Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-144929 Change-Id: I50da4fef6aaaab12417dcee7a0258f08f357bc58 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit e11b858c4bd1d6677913f1ceb69b50ad5f753adc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Never return early from QQuickItem::setFocus() if focus != activeFocusOliver Eftevaag2026-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QQuickWindow first becomes active, it will give the root item focus by default, unless there exists an item with `focus: true`. If the root item was disabled, it would update the root item's QQuickItemPrivate::focus flag to be true, even though the item itself wouldn't become the window's active focus item. This would mean that calling QQuickItem::forceActiveFocus() later wouldn't work, since the final QQuickItem::setFocus() call on the root item would end up returning early (due to the QQuickItemPrivate::focus flag being true from the earlier call). When QQuickItem::setFocus() returns early, it won't be able to send focus change events to the necessary items, or update the window's active focus item, which meant that a call to forceActiveFocus() cannot succeed. It needs to call QQDAP::setFocusInScope() on the root item in order to actually change the active focus item. Fix the issue by ensuring that we always allow setFocus() to execute normally in cases where the item's activeFocus and focus states differ. In the above description of the problem that's reported in the bug report, the TextInput couldn't become the activeFocusItem, because a parent was disabled. And since we're not always guaranteed to have a window (and thus delivery agent) when inside QQuickItem::setFocus() it's a safer bet to just use the data already owned by QQuickItem. Fixes: QTBUG-135624 Pick-to: 6.10 6.8 Change-Id: I564143366674c3b7526bbb0fd1848c43195ffe05 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 7f8a43fadc1b1c80ed3a18cfbc8ec3c21c1cc8ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickWindow: don't pass const Connection to disconnect()Marc Mutz2026-04-141-1/+1
| | | | | | | | | | | | | | That overload will be deprecated, because the function modifies the argument. Amends a346f6d0f3a26b134060b8d3f9e008a8e08353b9 (picked to 6.10). Pick-to: 6.10 Task-number: QTBUG-144929 Change-Id: I03895b65baf87058fbabefbfda3733936a3dd18f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 0a3ff11c2fad113fd0adb1ea659932011b2ecfc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix invalid index accesses in QList when loadedItems is emptyAndreas Hartmetz2026-04-141-2/+3
| | | | | | | | | | | The public rightColumn() etc accessors check for empty loadedItems, the private ones don't, so we need to check before using them. Fixes: QTBUG-145204 Change-Id: Ie0e1d38cf9bd8e6edd6ae20186609d85cd9a9912 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 202b8e51a2fd7317b347cd9adf7859d34d6a8652) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>