[vlc-devel] [PATCH 15/15] qml: Editor - Add hover highlight to EditorDND buttons

Rohan Rajpal rohan17089 at iiitd.ac.in
Mon Aug 12 15:24:29 CEST 2019


Add a highlight color to easily identify which button is going
to be active when you start DND.
---
 modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml | 2 ++
 modules/gui/qt/qml/dialogs/EditorDNDView.qml     | 4 ++++
 modules/gui/qt/qml/dialogs/ToolbarEditor.qml     | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml b/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
index c157108a60..7aed669f3c 100644
--- a/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
+++ b/modules/gui/qt/qml/dialogs/EditorDNDDelegate.qml
@@ -35,6 +35,7 @@ MouseArea {
     drag.target: held ? content : undefined
     width: buttonloader.width
     height: VLCStyle.icon_medium
+    hoverEnabled: true
 
     Rectangle {
         z: 1
@@ -49,6 +50,7 @@ MouseArea {
         color: VLCStyle.colors.accent
     }
     onPressed: held = true
+    onEntered: playerBtnDND.currentIndex = index
 
     onExited: {
         if(containsPress)
diff --git a/modules/gui/qt/qml/dialogs/EditorDNDView.qml b/modules/gui/qt/qml/dialogs/EditorDNDView.qml
index ed34f2fc16..e9c302d18d 100644
--- a/modules/gui/qt/qml/dialogs/EditorDNDView.qml
+++ b/modules/gui/qt/qml/dialogs/EditorDNDView.qml
@@ -89,6 +89,10 @@ ListView {
     delegate: EditorDNDDelegate {
         dndView: playerBtnDND
     }
+    highlight: Rectangle{
+        anchors.verticalCenter: currentIndex > 0 ? parent.verticalCenter : undefined
+        color: VLCStyle.colors.bgHover
+    }
     displaced: Transition {
         NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
     }
diff --git a/modules/gui/qt/qml/dialogs/ToolbarEditor.qml b/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
index a05586a687..1e65f9fdce 100644
--- a/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
+++ b/modules/gui/qt/qml/dialogs/ToolbarEditor.qml
@@ -132,6 +132,8 @@ Rectangle{
     Connections{
         target: toolbareditor
         onUpdatePlayerModel: {
+            playerBtnDND.currentIndex = -1
+            miniPlayerBtnDND.currentIndex = -1
             if (toolbarName == "MainPlayerToolbar")
                 playerControlBarModel.reloadConfig(config)
             else
-- 
2.17.1



More information about the vlc-devel mailing list