[vlc-commits] qml: use FocusBackground rather than local implementation

Pierre Lamot git at videolan.org
Fri Jan 10 15:07:01 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Jan  7 18:20:07 2020 +0100| [9eedc3efb9949a9d3c9dc5f3b3497b6572b4269b] | committer: Jean-Baptiste Kempf

qml: use FocusBackground rather than local implementation

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/player/qml/MiniPlayer.qml      |  3 +--
 modules/gui/qt/player/qml/PlayerMenuItem.qml  |  4 ++--
 modules/gui/qt/widgets/qml/IconToolButton.qml | 12 ++----------
 modules/gui/qt/widgets/qml/ListItem.qml       |  9 ---------
 modules/gui/qt/widgets/qml/TabButtonExt.qml   |  6 ++----
 modules/gui/qt/widgets/qml/TextToolButton.qml |  5 ++---
 6 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index a57461c7a8..44fd52b0e7 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -63,13 +63,12 @@ Widgets.NavigableFocusScope {
             anchors.rightMargin: VLCStyle.applicationHorizontalMargin
             anchors.bottomMargin: VLCStyle.applicationVerticalMargin
 
-            Rectangle {
+            Widgets.FocusBackground {
                 id: playingItemInfo
                 Layout.fillHeight: true
                 Layout.preferredWidth: playingItemInfoRow.implicitWidth
                 width: childrenRect.width
                 focus: true
-                color: activeFocus ? VLCStyle.colors.accent :  "transparent"
 
                 MouseArea {
                     anchors.fill: parent
diff --git a/modules/gui/qt/player/qml/PlayerMenuItem.qml b/modules/gui/qt/player/qml/PlayerMenuItem.qml
index cb157cabec..e8c2458185 100644
--- a/modules/gui/qt/player/qml/PlayerMenuItem.qml
+++ b/modules/gui/qt/player/qml/PlayerMenuItem.qml
@@ -104,9 +104,9 @@ T.MenuItem {
     }
 
 
-    background: Rectangle {
+    background: Widgets.FocusBackground {
         implicitHeight: VLCStyle.fontHeight_normal
-        color: control.highlighted ? VLCStyle.colors.accent : "transparent"
+        active: control.highlighted
     }
 
     //hack around QTBUG-79115
diff --git a/modules/gui/qt/widgets/qml/IconToolButton.qml b/modules/gui/qt/widgets/qml/IconToolButton.qml
index 14fa2e9180..3c7a6b7ddf 100644
--- a/modules/gui/qt/widgets/qml/IconToolButton.qml
+++ b/modules/gui/qt/widgets/qml/IconToolButton.qml
@@ -26,8 +26,6 @@ ToolButton {
 
     property int size: VLCStyle.icon_normal
 
-    property color highlightColor: VLCStyle.colors.accent
-
     padding: 0
 
     property string iconText: ""
@@ -41,12 +39,6 @@ ToolButton {
 
     contentItem: Item {
 
-        Rectangle {
-            anchors.fill: parent
-            visible: control.activeFocus || control.hovered || control.highlighted
-            color: highlightColor
-        }
-
         Label {
             id: text
             text: control.iconText
@@ -98,9 +90,9 @@ ToolButton {
         }
     }
 
-    background: Rectangle {
+    background: FocusBackground {
+        active: control.activeFocus || control.hovered || control.highlighted
         implicitHeight: control.size
         implicitWidth: control.size
-        color: "transparent"
     }
 }
diff --git a/modules/gui/qt/widgets/qml/ListItem.qml b/modules/gui/qt/widgets/qml/ListItem.qml
index 0e9dc97dcd..0936697232 100644
--- a/modules/gui/qt/widgets/qml/ListItem.qml
+++ b/modules/gui/qt/widgets/qml/ListItem.qml
@@ -59,9 +59,6 @@ NavigableFocusScope {
 
             font.underline: activeFocus
 
-            highlightColor: VLCStyle.colors.getBgColor(
-                                root.isSelected, root.hovered,
-                                root.activeFocus)
             //visible: mouse.containsMouse || root.activeFocus
             onClicked: root.addToPlaylistClicked()
         }
@@ -81,9 +78,6 @@ NavigableFocusScope {
 
             font.underline: activeFocus
 
-            highlightColor: VLCStyle.colors.getBgColor(
-                                root.isSelected, root.hovered,
-                                root.activeFocus)
             onClicked: root.playClicked()
         }
     }
@@ -215,9 +209,6 @@ NavigableFocusScope {
 
                                 font.underline: activeFocus
 
-                                highlightColor: VLCStyle.colors.getBgColor(
-                                                    root.isSelected, root.hovered,
-                                                    root.activeFocus)
                                 onClicked: root.contextMenuButtonClicked(this)
                             }
                         }
diff --git a/modules/gui/qt/widgets/qml/TabButtonExt.qml b/modules/gui/qt/widgets/qml/TabButtonExt.qml
index 782441df53..06e206906b 100644
--- a/modules/gui/qt/widgets/qml/TabButtonExt.qml
+++ b/modules/gui/qt/widgets/qml/TabButtonExt.qml
@@ -40,12 +40,10 @@ T.TabButton {
 
     font.pixelSize: VLCStyle.fontSize_normal
 
-    background: Rectangle {
+    background: FocusBackground {
         height: control.height
         width: control.width
-        color: (control.activeFocus || control.hovered)
-               ? VLCStyle.colors.accent
-               : control.bgColor
+        active: (control.activeFocus || control.hovered)
     }
 
     contentItem: Item {
diff --git a/modules/gui/qt/widgets/qml/TextToolButton.qml b/modules/gui/qt/widgets/qml/TextToolButton.qml
index 558baba334..716f076685 100644
--- a/modules/gui/qt/widgets/qml/TextToolButton.qml
+++ b/modules/gui/qt/widgets/qml/TextToolButton.qml
@@ -45,12 +45,11 @@ ToolButton {
                 bottom: parent.bottom
             }
             height: 2
-            visible: control.activeFocus || control.checked
+            visible: control.checked
             color: control.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.bgHover
         }
     }
 
-    background: Rectangle {
-        color: "transparent"
+    background: FocusBackground {
     }
 }



More information about the vlc-commits mailing list