summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/3rdparty/0013-ActionButton-icon-coloring.patch
blob: 4dc51cfccef222980a414d285f550d21ae9ca631 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From ddd8f74f5ca5d696a3bd8742cff66c2e55cc1cb7 Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <dirk@hohndel.org>
Date: Sat, 19 Dec 2020 13:58:28 -0800
Subject: [PATCH] ActionButton icon coloring

The ActionButton code assumes that there is a property 'color' on a
Kirigami.Action and then uses that to override the color for the icon.
Unfortunately that property didn't exist - and for strange reason all
three buttons were implemented using the color of the center button,
which is kinda weird since they have different backgrounds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
---
 src/controls/Action.qml               | 6 ++++++
 src/controls/private/ActionButton.qml | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/controls/Action.qml b/src/controls/Action.qml
index adc1ea3e..7367fc2f 100644
--- a/src/controls/Action.qml
+++ b/src/controls/Action.qml
@@ -74,6 +74,12 @@ Controls.Action {
      */
     property string tooltip
 
+    /**
+     * color: color
+     * used to colorize the icon in the ActionButton
+     */
+    property color color
+
     /**
      * children: list<Action>
      * A list of children actions.
diff --git a/src/controls/private/ActionButton.qml b/src/controls/private/ActionButton.qml
index 1d4e4b7a..f216af8d 100644
--- a/src/controls/private/ActionButton.qml
+++ b/src/controls/private/ActionButton.qml
@@ -251,7 +251,7 @@ Item {
                         width: Units.iconSizes.smallMedium
                         height: width
                         selected: leftButtonGraphics.pressed
-                        color: root.action && root.action.color && root.action.color.a > 0 ? root.action.color : (selected ? Theme.highlightedTextColor : Theme.textColor)
+                        color: root.leftAction && root.leftAction.color && root.leftAction.color.a > 0 ? root.leftAction.color : (selected ? Theme.highlightedTextColor : Theme.textColor)
                         anchors {
                             left: parent.left
                             verticalCenter: parent.verticalCenter
@@ -308,7 +308,7 @@ Item {
                         width: Units.iconSizes.smallMedium
                         height: width
                         selected: rightButtonGraphics.pressed
-                        color: root.action && root.action.color && root.action.color.a > 0 ? root.action.color : (selected ? Theme.highlightedTextColor : Theme.textColor)
+                        color: root.rightAction && root.rightAction.color && root.rightAction.color.a > 0 ? root.rightAction.color : (selected ? Theme.highlightedTextColor : Theme.textColor)
                         anchors {
                             right: parent.right
                             verticalCenter: parent.verticalCenter
-- 
2.25.1