diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-25 01:02:20 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-25 01:02:20 +0200 |
commit | 6a607fbe1523687ad106100dfa25ba9eeeaf8f13 (patch) | |
tree | 66b03787a4d409199835bc056e103c423b8bedd0 /framework/qml/AbstractButton.qml | |
parent | cd44f523affbaa55d74ff139e9dbb54776dc9d71 (diff) | |
download | kube-6a607fbe1523687ad106100dfa25ba9eeeaf8f13.tar.gz kube-6a607fbe1523687ad106100dfa25ba9eeeaf8f13.zip |
Standardized focus highlighting via AbstractButton for PositiveButton
and Button
Diffstat (limited to 'framework/qml/AbstractButton.qml')
-rw-r--r-- | framework/qml/AbstractButton.qml | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/framework/qml/AbstractButton.qml b/framework/qml/AbstractButton.qml index a92ab5df..194812da 100644 --- a/framework/qml/AbstractButton.qml +++ b/framework/qml/AbstractButton.qml | |||
@@ -25,27 +25,49 @@ T.Button { | |||
25 | id: root | 25 | id: root |
26 | 26 | ||
27 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | 27 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) |
28 | height: contentItem.implicitHeight + Units.smallSpacing * 2 | 28 | height: contentItem.implicitHeight + topPadding + bottomPadding |
29 | 29 | ||
30 | padding: Units.largeSpacing | 30 | padding: Units.largeSpacing |
31 | topPadding: Units.smallSpacing * 2 | 31 | topPadding: Units.smallSpacing |
32 | bottomPadding: Units.smallSpacing *2 | 32 | bottomPadding: Units.smallSpacing |
33 | 33 | ||
34 | clip: true | 34 | clip: true |
35 | hoverEnabled: true | 35 | hoverEnabled: true |
36 | Keys.onReturnPressed: root.clicked() | 36 | Keys.onReturnPressed: root.clicked() |
37 | 37 | ||
38 | property color color: Colors.buttonColor | ||
39 | property color textColor: Colors.textColor | ||
40 | |||
38 | background: Rectangle { | 41 | background: Rectangle { |
39 | color: Colors.buttonColor | 42 | color: root.color |
43 | |||
44 | Rectangle { | ||
45 | anchors.fill: parent | ||
46 | visible: root.checked | ||
47 | color: Colors.highlightColor | ||
48 | } | ||
40 | 49 | ||
41 | border.width: 2 | 50 | Rectangle { |
42 | border.color: root.activeFocus && !root.pressed ? Colors.highlightColor : Colors.buttonColor | 51 | anchors.fill: parent |
52 | visible: root.hovered || root.visualFocus | ||
53 | color: "transparent" | ||
54 | border.width: 2 | ||
55 | border.color: Colors.focusedButtonColor | ||
56 | } | ||
43 | 57 | ||
44 | Rectangle { | 58 | Rectangle { |
45 | anchors.fill: parent | 59 | anchors.fill: parent |
46 | visible: root.hovered || root.pressed | 60 | visible: root.pressed |
47 | color: root.pressed ? Colors.textColor : Colors.viewBackgroundColor | 61 | color: Colors.textColor |
48 | opacity: 0.2 | 62 | opacity: 0.2 |
49 | } | 63 | } |
50 | } | 64 | } |
65 | |||
66 | contentItem: Label { | ||
67 | text: root.text | ||
68 | elide: Text.ElideRight | ||
69 | horizontalAlignment: Text.AlignHCenter | ||
70 | verticalAlignment: Text.AlignVCenter | ||
71 | color: root.textColor | ||
72 | } | ||
51 | } | 73 | } |