[vlc-commits] qt: playlist: use the drag object
Romain Vimont
git at videolan.org
Tue Jul 16 14:20:54 CEST 2019
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Fri Jul 12 16:20:37 2019 +0200| [ac45c291446695aead0555a6f6d61bac2b7cd649] | committer: Jean-Baptiste Kempf
qt: playlist: use the drag object
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.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac45c291446695aead0555a6f6d61bac2b7cd649
---
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
More information about the vlc-commits
mailing list