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/PositiveButton.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/PositiveButton.qml')
-rw-r--r-- | framework/qml/PositiveButton.qml | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/framework/qml/PositiveButton.qml b/framework/qml/PositiveButton.qml index a3b68d26..32bd7508 100644 --- a/framework/qml/PositiveButton.qml +++ b/framework/qml/PositiveButton.qml | |||
@@ -16,44 +16,9 @@ | |||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Templates 2.0 as T | ||
21 | import org.kube.framework 1.0 | 19 | import org.kube.framework 1.0 |
22 | 20 | ||
23 | T.Button { | 21 | AbstractButton { |
24 | id: root | 22 | color: Colors.positiveColor |
25 | 23 | textColor: Colors.highlightedTextColor | |
26 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | ||
27 | height: contentItem.implicitHeight + Units.smallSpacing * 2 | ||
28 | |||
29 | padding: Units.largeSpacing | ||
30 | topPadding: Units.smallSpacing * 2 | ||
31 | bottomPadding: Units.smallSpacing *2 | ||
32 | |||
33 | clip: true | ||
34 | hoverEnabled: true | ||
35 | Keys.onReturnPressed: root.clicked() | ||
36 | |||
37 | background: Rectangle { | ||
38 | color: Colors.positiveColor | ||
39 | |||
40 | border.width: 2 | ||
41 | border.color: root.visualFocus && !root.pressed ? Colors.highlightColor : Colors.positiveColor | ||
42 | |||
43 | Rectangle { | ||
44 | anchors.fill: parent | ||
45 | visible: root.hovered || root.pressed | ||
46 | color: root.pressed ? Colors.textColor : Colors.viewBackgroundColor | ||
47 | opacity: 0.2 | ||
48 | } | ||
49 | } | ||
50 | |||
51 | contentItem: Label { | ||
52 | text: root.text | ||
53 | font.underline: root.activeFocus | ||
54 | elide: Text.ElideRight | ||
55 | horizontalAlignment: Text.AlignHCenter | ||
56 | verticalAlignment: Text.AlignVCenter | ||
57 | color: Colors.highlightedTextColor | ||
58 | } | ||
59 | } | 24 | } |