[vlc-commits] qml: fix playlist external drag & drop

Fatih Uzunoglu git at videolan.org
Thu Oct 15 10:32:36 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Oct  9 19:56:28 2020 +0300| [f28678b2aff8d25b1098f06e86ad6a04b47cec79] | committer: Pierre Lamot

qml: fix playlist external drag & drop

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

 modules/gui/qt/playlist/qml/PLItem.qml           | 33 ++++++++++++++----------
 modules/gui/qt/playlist/qml/PlaylistListView.qml |  7 +++--
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index 9476e061cc..48cdca3e75 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -310,21 +310,25 @@ Rectangle {
                 Layout.preferredHeight: parent.height / 2
 
                 onEntered: {
-                    var delta = drag.source.model.index - model.index
+                    var delta = 1
+
+                    if(!drag.hasUrls)
+                        delta = drag.source.model.index - model.index
+
                     if(delta === 0 || delta === -1)
                         return
 
                     dropVisible = true
                 }
                 onExited: {
-                    var delta = drag.source.model.index - model.index
-                    if(delta === 0 || delta === -1)
-                        return
-
                     dropVisible = false
                 }
                 onDropped: {
-                    var delta = drag.source.model.index - model.index
+                    var delta = 1
+
+                    if(!drop.hasUrls)
+                        delta = drag.source.model.index - model.index
+
                     if(delta === 0 || delta === -1)
                         return
 
@@ -341,7 +345,11 @@ Rectangle {
                 property bool _isLastItem : model.index === plitem.plmodel.count - 1
 
                 onEntered: {
-                    var delta = drag.source.model.index - model.index
+                    var delta = -1
+
+                    if(!drag.hasUrls)
+                        delta = drag.source.model.index - model.index
+
                     if(delta === 0 || delta === 1)
                         return
 
@@ -355,10 +363,6 @@ Rectangle {
                     }
                 }
                 onExited: {
-                    var delta = drag.source.model.index - model.index
-                    if(delta === 0 || delta === 1)
-                        return
-
                     if (_isLastItem)
                     {
                         root.setItemDropIndicatorVisible(model.index, false, false);
@@ -369,7 +373,11 @@ Rectangle {
                     }
                 }
                 onDropped: {
-                    var delta = drag.source.model.index - model.index
+                    var delta = -1
+
+                    if(!drop.hasUrls)
+                        delta = drag.source.model.index - model.index
+
                     if(delta === 0 || delta === 1)
                         return
 
@@ -394,7 +402,6 @@ Rectangle {
                     }
                 }
             }
-
         }
     }
 }
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 37079a4077..5d9fc8000b 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -301,19 +301,18 @@ Widgets.NavigableFocusScope {
                     DropArea {
                         anchors.fill: parent
                         onEntered: {
-                            if(drag.source.model.index === root.plmodel.count - 1)
+                            if(!drag.hasUrls && drag.source.model.index === root.plmodel.count - 1)
                                 return
 
                             root.setItemDropIndicatorVisible(view.modelCount - 1, true, false);
                         }
                         onExited: {
-                            if(drag.source.model.index === root.plmodel.count - 1)
-                                return
+
 
                             root.setItemDropIndicatorVisible(view.modelCount - 1, false, false);
                         }
                         onDropped: {
-                            if(drag.source.model.index === root.plmodel.count - 1)
+                            if(!drop.hasUrls && drop.source.model.index === root.plmodel.count - 1)
                                 return
 
                             if (drop.hasUrls) {



More information about the vlc-commits mailing list