[vlc-devel] [PATCH 19/27] qml: set proper colors for playlist item

Fatih Uzunoglu fuzun54 at outlook.com
Fri Oct 9 18:56:40 CEST 2020


---
 modules/gui/qt/playlist/qml/PLItem.qml           |  7 -------
 modules/gui/qt/playlist/qml/PlaylistListView.qml |  2 +-
 modules/gui/qt/style/VLCColors.qml               | 13 +++++++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PLItem.qml b/modules/gui/qt/playlist/qml/PLItem.qml
index a3e72fcfb7..831174991d 100644
--- a/modules/gui/qt/playlist/qml/PLItem.qml
+++ b/modules/gui/qt/playlist/qml/PLItem.qml
@@ -159,13 +159,6 @@ Rectangle {
             }
         }
 
-        Rectangle {
-            id: selectedBackground
-            color: _colors.bg
-            anchors.fill: parent
-            visible: model.isCurrent && !plitem.hovered && !model.selected
-        }
-
         RowLayout {
             id: content
             anchors {
diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index b833e42168..ca13da18d5 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -453,7 +453,7 @@ Widgets.NavigableFocusScope {
                                 contextMenu.popup(index, globalMousePos)
                         }
                         onItemDoubleClicked: mainPlaylistController.goTo(index, true)
-                        color: _colors.getBgColor(model.selected, plitem.hovered, plitem.activeFocus)
+                        color: _colors.getPLItemColor(model.selected, plitem.hovered, plitem.activeFocus)
                         _colors: root._colors
 
                         onDragStarting: {
diff --git a/modules/gui/qt/style/VLCColors.qml b/modules/gui/qt/style/VLCColors.qml
index 19094ad519..a3d36f1e52 100644
--- a/modules/gui/qt/style/VLCColors.qml
+++ b/modules/gui/qt/style/VLCColors.qml
@@ -86,7 +86,20 @@ Item {
     
     property color roundPlayCoverBorder: "#979797"
 
+    // playlist
     property color playlistSeparator: colors_id.white
+    property color plItemHover_Focus: isThemeDark ? "#272727" : "#DDDDDD"
+    property color plItemSelect:      isThemeDark ? "#1E1E1E" : "#EDEDED"
+
+    function getPLItemColor(selected, hovered, focus)
+    {
+        if (hovered || focus)
+            return plItemHover_Focus
+        else if ( selected )
+            return plItemSelect
+        else
+            return "transparent"
+    }
 
     // basic color definitions for color blending:
     property color black: "black"
-- 
2.25.1



More information about the vlc-devel mailing list