aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/externaldrag.qml
Commit message (Collapse)AuthorAgeFilesLines
* doc: Set Drag.imageSource before Drag.active to avoid race conditionShawn Rutledge2023-11-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | grabToImage() is asynchronous. 4b982c744f538a24e21a2af146c45f93d27dd1cb started it on mouse press, which generally gave it enough time before the QDrag became active; but 5971a6faaa1124f5ef3f0b42d4ed0298cf8096a3 changed it to call grabToImage() in DragHandler.onActiveChanged, which means waiting until the drag threshold is exceeded. (DragHandler doesn't offer a way to detect when the point is pressed. One could probably use a separate TapHandler or PointHandler just to detect the press; but that's also inefficient and inconvenient.) If we also bind Drag.active to DragHandler.active, it's very likely that the binding is updated before grabToImage() is done; and as documented, setting imageSource after the drag has started has no effect (that in turn is a limitation in QDrag and the platform support, probably a limitation on actual platforms). So just wait until the screen-grab is done before setting Drag.active, as a workaround for now. This is a step back in declarativeness, using JS rather than a binding. But setting imageSource to a screen-grab unfortunately requires JS anyway; so we might as well delay making the Drag active until the screen-grab is done. Fixes: QTBUG-112673 Fixes: QTBUG-115491 Pick-to: 6.2 6.5 6.6 Change-Id: I0317613aa0288ad99b55ebd8a470500432b2ea02 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Don't use versioned Qt imports in QML snippetsKai Köhne2023-06-301-1/+1
| | | | | | | | | | | We don't promote versioned imports anymore in Qt 6. Patch done by find . -path "*/snippets/*.qml" -exec perl -pi -e "s/import Qt([\.a-zA-Z]*) \d\.\d+/import Qt\\1/g" {} ; Pick-to: 6.5 6.6 Change-Id: I20a5bf52f7cdd99124626f85ce9794af74382977 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-49/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: Use DragHandler rather than MouseArea in the externaldrag snippetShawn Rutledge2021-06-231-10/+10
| | | | | | | | Task-number: QTBUG-68078 Task-number: QTBUG-76310 Pick-to: 5.15 Change-Id: Id7b971f5147474274200ef2fdd52ce21f8d60bdd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix outdated BSD license headerKai Koehne2017-10-171-3/+13
| | | | | Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Add imageSource property to attached Drag propertyAlberto Mardegan2016-05-071-0/+76
This property holds a URL which is loaded into a QPixmap via QQuickPixmap, and subsequently set on the QDrag object. This is especially important for drag and drop to external applications, where of course a QQuickItem cannot be dragged; however, combined with QQuickItem::grabToImage(), this change allows setting a QQuickItem's contents as the drag pixmap. [ChangeLog][QtQuick][Drag] Added imageSource property to attached Drag object: this allows drag sources to specify the pixmap to be drawn next to the mouse cursor when starting a drag and drop operation. Task-number: QTBUG-37366 Change-Id: Ibcf1d888c525e50976a116ec743ce6fca4c31525 Reviewed-by: Michael Brasser <michael.brasser@live.com>