[vlc-devel] [PATCH 4/8] qml: Add stack support to Icons

Rohan Rajpal rohan17089 at iiitd.ac.in
Mon Jun 17 16:54:58 CEST 2019


Add icon stacking support to IconToolButton
Also add changes color when icon is checked
---
 modules/gui/qt/qml/utils/IconToolButton.qml | 26 ++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/qml/utils/IconToolButton.qml b/modules/gui/qt/qml/utils/IconToolButton.qml
index d142d0632f..6b0bcd0199 100644
--- a/modules/gui/qt/qml/utils/IconToolButton.qml
+++ b/modules/gui/qt/qml/utils/IconToolButton.qml
@@ -23,7 +23,7 @@ import "qrc:///style/"
 ToolButton {
     id: control
     property color color: control.enabled ?
-                    VLCStyle.colors.buttonText : VLCStyle.colors.lightText
+                              VLCStyle.colors.buttonText : VLCStyle.colors.lightText
 
     property int size: VLCStyle.icon_normal
 
@@ -31,8 +31,17 @@ ToolButton {
 
     padding: 0
 
+    property color colorOverlay: "transparent"
+    property string textOverlay: ""
+
     contentItem: Item {
 
+        Rectangle{
+            anchors.fill: parent
+            visible: control.checked
+            color: VLCStyle.colors.bannerHover
+        }
+
         Rectangle {
             anchors.fill: parent
             visible: control.activeFocus || control.hovered || control.highlighted
@@ -51,6 +60,21 @@ ToolButton {
 
             verticalAlignment: Text.AlignVCenter
             horizontalAlignment: Text.AlignHCenter
+
+            Label {
+                text: control.textOverlay
+                color: control.colorOverlay
+
+                anchors.centerIn: parent
+
+                font.pixelSize: control.size
+                font.family: VLCIcons.fontFamily
+
+                verticalAlignment: Text.AlignVCenter
+                horizontalAlignment: Text.AlignHCenter
+
+            }
+
         }
     }
 
-- 
2.17.1



More information about the vlc-devel mailing list