[vlc-commits] qml: add separator to Playlist delegate

Fatih Uzunoglu git at videolan.org
Fri Jul 3 14:59:04 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Mon Jun 22 20:40:27 2020 +0300| [29c6d62f5b283b9978fb09c276de26258ba29198] | committer: Pierre Lamot

qml: add separator to Playlist delegate

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

 modules/gui/qt/playlist/qml/PlaylistListView.qml | 105 ++++++++++++-----------
 1 file changed, 57 insertions(+), 48 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 0a748c84eb..1b797683e6 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -165,59 +165,68 @@ Widgets.NavigableFocusScope {
             onMoveAtEnd: root.plmodel.moveItemsPost(root.plmodel.getSelection(), root.plmodel.count - 1)
         }
 
-        delegate: PLItem {
-            /*
-             * implicit variables:
-             *  - model: gives access to the values associated to PlaylistListModel roles
-             *  - index: the index of this item in the list
-             */
-            id: plitem
-            plmodel: root.plmodel
-            width: root.width
-
-            leftPadding: root.leftPadding
-            rightPadding: root.rightPadding + view.scrollBarWidth
-
-            onItemClicked : {
-                /* to receive keys events */
-                view.forceActiveFocus()
-                if (view.mode == "move") {
-                    var selectedIndexes = root.plmodel.getSelection()
-                    if (selectedIndexes.length === 0)
-                        return
-                    var preTarget = index
-                    /* move to _above_ the clicked item if move up, but
-                     * _below_ the clicked item if move down */
-                    if (preTarget > selectedIndexes[0])
-                        preTarget++
-                    view.currentIndex = selectedIndexes[0]
-                    root.plmodel.moveItemsPre(selectedIndexes, preTarget)
-                } else if (view.mode == "select") {
-                } else {
-                    view.updateSelection(modifier, view.currentIndex, index)
-                    view.currentIndex = index
+        delegate: Column {
+            PLItem {
+                /*
+                 * implicit variables:
+                 *  - model: gives access to the values associated to PlaylistListModel roles
+                 *  - index: the index of this item in the list
+                 */
+                id: plitem
+                plmodel: root.plmodel
+                width: root.width
+
+                leftPadding: root.leftPadding
+                rightPadding: root.rightPadding + view.scrollBarWidth
+
+                onItemClicked : {
+                    /* to receive keys events */
+                    view.forceActiveFocus()
+                    if (view.mode == "move") {
+                        var selectedIndexes = root.plmodel.getSelection()
+                        if (selectedIndexes.length === 0)
+                            return
+                        var preTarget = index
+                        /* move to _above_ the clicked item if move up, but
+                         * _below_ the clicked item if move down */
+                        if (preTarget > selectedIndexes[0])
+                            preTarget++
+                        view.currentIndex = selectedIndexes[0]
+                        root.plmodel.moveItemsPre(selectedIndexes, preTarget)
+                    } else if (view.mode == "select") {
+                    } else {
+                        view.updateSelection(modifier, view.currentIndex, index)
+                        view.currentIndex = index
+                    }
+                }
+                onItemDoubleClicked: mainPlaylistController.goTo(index, true)
+                color: VLCStyle.colors.getBgColor(model.selected, plitem.hovered, plitem.activeFocus)
+
+                onDragStarting: {
+                    if (!root.plmodel.isSelected(index)) {
+                        /* the dragged item is not in the selection, replace the selection */
+                        root.plmodel.setSelection([index])
+                    }
                 }
-            }
-            onItemDoubleClicked: mainPlaylistController.goTo(index, true)
-            color: VLCStyle.colors.getBgColor(model.selected, plitem.hovered, plitem.activeFocus)
 
-            onDragStarting: {
-                if (!root.plmodel.isSelected(index)) {
-                    /* the dragged item is not in the selection, replace the selection */
-                    root.plmodel.setSelection([index])
+                onDropedMovedAt: {
+                    if (drop.hasUrls) {
+                        //force conversion to an actual list
+                        var urlList = []
+                        for ( var url in drop.urls)
+                            urlList.push(drop.urls[url])
+                        mainPlaylistController.insert(target, urlList)
+                    } else {
+                        root.plmodel.moveItemsPre(root.plmodel.getSelection(), target)
+                    }
                 }
             }
 
-            onDropedMovedAt: {
-                if (drop.hasUrls) {
-                    //force conversion to an actual list
-                    var urlList = []
-                    for ( var url in drop.urls)
-                        urlList.push(drop.urls[url])
-                    mainPlaylistController.insert(target, urlList)
-                } else {
-                    root.plmodel.moveItemsPre(root.plmodel.getSelection(), target)
-                }
+            Rectangle {
+                width: parent.width
+                height: 1
+                color: VLCStyle.colors.white
+                opacity: VLCStyle.colors.isThemeDark ? 0.05 : 1.0
             }
         }
 



More information about the vlc-commits mailing list