[vlc-devel] [PATCH 04/15] qml: Make Editor DND Delegate support multiple views

Rohan Rajpal rohan17089 at iiitd.ac.in
Mon Aug 12 15:24:18 CEST 2019


---
 .../gui/qt/qml/dialogs/EditorDNDDelegate.qml    | 17 +++++++++--------
 modules/gui/qt/qml/dialogs/ToolbarEditor.qml    |  4 +++-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml b/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
index 12ed394629..c157108a60 100644
--- a/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
+++ b/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
@@ -29,6 +29,7 @@ MouseArea {
 
     property bool held: false
     property bool dropVisible: false
+    property var dndView: null
     anchors.verticalCenter: parent.verticalCenter
     cursorShape: dropVisible ? Qt.DragMoveCursor : Qt.OpenHandCursor
     drag.target: held ? content : undefined
@@ -51,15 +52,15 @@ MouseArea {
 
     onExited: {
         if(containsPress)
-            playerBtnDND.deleteBtn = true
+            dndView.deleteBtn = true
     }
 
     onReleased: {
         drag.target.Drag.drop()
         held = false
-        if(playerBtnDND.deleteBtn){
-            playerBtnDND.deleteBtn = false
-            playerBtnDND.model.remove(
+        if(dndView.deleteBtn){
+            dndView.deleteBtn = false
+            dndView.model.remove(
                         dragArea.DelegateModel.itemsIndex)
         }
     }
@@ -98,18 +99,18 @@ MouseArea {
 
         onEntered: {
             dropVisible = true
-            playerBtnDND.deleteBtn = false
+            dndView.deleteBtn = false
         }
 
         onExited: {
             dropVisible = false
-            if(!playerBtnDND.addBtn)
-                playerBtnDND.deleteBtn = true
+            if(!dndView.addBtn)
+                dndView.deleteBtn = true
         }
 
         onDropped: {
             if (drag.source.objectName == "buttonsList")
-                playerBtnDND.model.insert(parent.DelegateModel.itemsIndex,
+                dndView.model.insert(parent.DelegateModel.itemsIndex,
                                             {"id" : drag.source.mIndex,
                                                 "size": bigButton.checked ?
                                                             PlayerControlBarModel.WIDGET_BIG :
diff --git a/modules/gui/qt/qml/dialogs/ToolbarEditor.qml b/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
index 91f1ed8d2c..d2b1b83f4d 100644
--- a/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
+++ b/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
@@ -121,7 +121,9 @@ Rectangle{
                     }
 
                     model: playerControlBarModel
-                    delegate: EditorDNDDelegate {}
+                    delegate: EditorDNDDelegate {
+                        dndView: playerBtnDND
+                    }
                     displaced: Transition {
                         NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
                     }
-- 
2.17.1



More information about the vlc-devel mailing list