aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-06-13 19:36:25 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-06-23 17:43:35 +0000
commit5971a6faaa1124f5ef3f0b42d4ed0298cf8096a3 (patch)
tree8e3fc1074d846c41d0eba579dc239e1cb5dfbc2e /src/quick/doc/snippets/qml
parentcbc1693c6368e593d46db35c30056500dbe7a3e4 (diff)
doc: Use DragHandler rather than MouseArea in the externaldrag snippet
Task-number: QTBUG-68078 Task-number: QTBUG-76310 Pick-to: 5.15 Change-Id: Id7b971f5147474274200ef2fdd52ce21f8d60bdd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml')
-rw-r--r--src/quick/doc/snippets/qml/externaldrag.qml20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/quick/doc/snippets/qml/externaldrag.qml b/src/quick/doc/snippets/qml/externaldrag.qml
index 97a23293ca..5a88be2d4b 100644
--- a/src/quick/doc/snippets/qml/externaldrag.qml
+++ b/src/quick/doc/snippets/qml/externaldrag.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
//![0]
-import QtQuick 2.8
+import QtQuick 2.12
Item {
width: 200; height: 200
@@ -59,7 +59,7 @@ Item {
color: "green"
radius: 5
- Drag.active: dragArea.drag.active
+ Drag.active: dragHandler.active
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData: {
@@ -72,14 +72,14 @@ Item {
text: "Drag me"
}
- MouseArea {
- id: dragArea
- anchors.fill: parent
-
- drag.target: parent
- onPressed: parent.grabToImage(function(result) {
- parent.Drag.imageSource = result.url
- })
+ DragHandler {
+ id: dragHandler
+ onActiveChanged:
+ if (active) {
+ parent.grabToImage(function(result) {
+ parent.Drag.imageSource = result.url;
+ })
+ }
}
}
}