[vlc-commits] qml: move bottom drop indicator to footer in playlist

Fatih Uzunoglu git at videolan.org
Tue Jan 12 13:20:43 UTC 2021


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jan  8 00:36:45 2021 +0300| [bca1010420f1d51be2c333673cf5294518eef631] | committer: Pierre Lamot

qml: move bottom drop indicator to footer in playlist

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/playlist/qml/PlaylistDelegate.qml | 18 --------------
 modules/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
                         }
                     }
                 }



More information about the vlc-commits mailing list