[vlc-devel] [RFC 2/3] qt: playlist: use the drag object
Romain Vimont
rom1v at videolabs.io
Fri Jul 12 16:20:37 CEST 2019
The drag&drop was initiated using "pressed" and "released" signals on
MouseArea.
Instead, use "drag.active", which takes a move threshold before
initiating a drag&drop.
---
modules/gui/qt/qml/playlist/PLItem.qml | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/qml/playlist/PLItem.qml b/modules/gui/qt/qml/playlist/PLItem.qml
index 7d14628a1b..8d18128f0a 100644
--- a/modules/gui/qt/qml/playlist/PLItem.qml
+++ b/modules/gui/qt/qml/playlist/PLItem.qml
@@ -71,21 +71,23 @@ Rectangle {
drag.target: dragItem
- onPositionChanged: {
- if (pressed && !dragItem.visible) {
- dragItem.count = plmodel.getSelection().length
- dragItem.visible = true
+ Connections {
+ target: mouse.drag
+ onActiveChanged: {
+ if (target.active) {
+ dragItem.count = plmodel.getSelection().length
+ dragItem.visible = true
+ } else {
+ dragItem.Drag.drop()
+ dragItem.visible = false
+ }
}
}
+
onPressed: {
var pos = this.mapToGlobal( mouseX, mouseY)
dragItem.updatePos(pos.x, pos.y)
}
- onReleased: {
- if (dragItem.visible)
- dragItem.Drag.drop()
- dragItem.visible = false
- }
RowLayout {
id: content
--
2.20.1
More information about the vlc-devel
mailing list