[vlc-devel] [RFC 1/3] qt: playlist: use existing "pressed" property

Romain Vimont rom1v at videolabs.io
Fri Jul 12 16:20:36 CEST 2019


MouseArea contains a "pressed" property. There is no need to maintain
our own.

<https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#pressed-prop>
---
 modules/gui/qt/qml/playlist/PLItem.qml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/modules/gui/qt/qml/playlist/PLItem.qml b/modules/gui/qt/qml/playlist/PLItem.qml
index fa75adbea2..7d14628a1b 100644
--- a/modules/gui/qt/qml/playlist/PLItem.qml
+++ b/modules/gui/qt/qml/playlist/PLItem.qml
@@ -71,15 +71,13 @@ Rectangle {
 
         drag.target: dragItem
 
-        property bool hold: false
         onPositionChanged: {
-            if (hold && !dragItem.visible) {
+            if (pressed && !dragItem.visible) {
                 dragItem.count = plmodel.getSelection().length
                 dragItem.visible = true
             }
         }
         onPressed:  {
-            hold = true
             var pos = this.mapToGlobal( mouseX, mouseY)
             dragItem.updatePos(pos.x, pos.y)
         }
@@ -87,7 +85,6 @@ Rectangle {
             if (dragItem.visible)
                 dragItem.Drag.drop()
             dragItem.visible = false
-            hold = false
         }
 
         RowLayout {
-- 
2.20.1



More information about the vlc-devel mailing list