[vlc-devel] [PATCH 32/55] qml: move bottom drop indicator to footer in playlist

Fatih Uzunoglu fuzun54 at outlook.com
Thu Jan 7 21:36:45 UTC 2021


---
 .../gui/qt/playlist/qml/PlaylistDelegate.qml  | 18 -----------
 .../gui/qt/playlist/qml/PlaylistListView.qml  | 31 ++++++++++++++-----
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistDelegate.qml b/modules/gui/qt/playlist/qml/PlaylistDelegate.qml
index 40828ced92..eb2017d74f 100644
--- a/modules/gui/qt/playlist/qml/PlaylistDelegate.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistDelegate.qml
@@ -126,24 +126,6 @@ Rectangle {
         color: colors.accent
     }
 
-    // bottom drop indicator bar
-    // only active when the item is the last item in the list
-    Loader {
-        id: bottomDropIndicator
-        active: model.index === _model.count - 1
-        visible: false
-
-        z: 1
-        width: parent.width
-        height: 1
-        anchors.top: parent.bottom
-        antialiasing: true
-
-        sourceComponent: Rectangle {
-            color: colors.accent
-        }
-    }
-
     MouseArea {
         id: mouse
         anchors.fill: parent
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 524fd45c98..eb81ee3f0b 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -309,6 +309,10 @@ Widgets.NavigableFocusScope {
                     width: parent.width
                     height: Math.max(VLCStyle.icon_normal, listView.height - y)
 
+                    function setDropIndicatorVisible(visible) {
+                        dropIndicator.visible = visible
+                    }
+
                     MouseArea {
                         anchors.fill: parent
                         acceptedButtons: Qt.RightButton | Qt.LeftButton
@@ -317,29 +321,42 @@ Widgets.NavigableFocusScope {
                             listView.forceActiveFocus()
                             if( mouse.button === Qt.RightButton )
                                 contextMenu.popup(-1, this.mapToGlobal(mouse.x, mouse.y))
-                            else if ( mouse.button === Qt.LeftButton )
-                                root.model.deselectAll()
                         }
                     }
 
+                    Rectangle {
+                        id: dropIndicator
+
+                        anchors.left: parent.left
+                        anchors.right: parent.right
+                        height: VLCStyle.dp(1)
+                        anchors.top: parent.top
+
+                        visible: false
+                        color: colors.accent
+                    }
+
                     DropArea {
+                        id: dropArea
+
                         anchors.fill: parent
+
                         onEntered: {
                             if(!root.isDropAcceptable(drag, root.model.count))
                                 return
 
-                            root.setItemDropIndicatorVisible(listView.modelCount - 1, true, false);
+                            dropIndicator.visible = true
                         }
                         onExited: {
-
-
-                            root.setItemDropIndicatorVisible(listView.modelCount - 1, false, false);
+                            dropIndicator.visible = false
                         }
                         onDropped: {
                             if(!root.isDropAcceptable(drop, root.model.count))
                                 return
+
                             root.acceptDrop(root.model.count, drop)
-                            root.setItemDropIndicatorVisible(listView.modelCount - 1, false, false);
+
+                            dropIndicator.visible = false
                         }
                     }
                 }
-- 
2.27.0



More information about the vlc-devel mailing list