[vlc-commits] qml: Make Editor DND Delegate support multiple views

Rohan Rajpal git at videolan.org
Wed Aug 21 16:26:58 CEST 2019


vlc | branch: master | Rohan Rajpal <rohan17089 at iiitd.ac.in> | Sat Aug 10 22:46:58 2019 +0530| [65c9fd051145e803e4b46d0e074b227d6fd363e5] | committer: Jean-Baptiste Kempf

qml: Make Editor DND Delegate support multiple views

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=65c9fd051145e803e4b46d0e074b227d6fd363e5
---

 modules/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 }
                     }



More information about the vlc-commits mailing list