summaryrefslogtreecommitdiffstats
path: root/framework/qml/Button.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-25 01:02:20 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-25 01:02:20 +0200
commit6a607fbe1523687ad106100dfa25ba9eeeaf8f13 (patch)
tree66b03787a4d409199835bc056e103c423b8bedd0 /framework/qml/Button.qml
parentcd44f523affbaa55d74ff139e9dbb54776dc9d71 (diff)
downloadkube-6a607fbe1523687ad106100dfa25ba9eeeaf8f13.tar.gz
kube-6a607fbe1523687ad106100dfa25ba9eeeaf8f13.zip
Standardized focus highlighting via AbstractButton for PositiveButton
and Button
Diffstat (limited to 'framework/qml/Button.qml')
-rw-r--r--framework/qml/Button.qml38
1 files changed, 1 insertions, 37 deletions
diff --git a/framework/qml/Button.qml b/framework/qml/Button.qml
index 80b7451a..f3251f4f 100644
--- a/framework/qml/Button.qml
+++ b/framework/qml/Button.qml
@@ -16,43 +16,7 @@
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
19import QtQuick 2.7
20import QtQuick.Templates 2.0 as T
21import org.kube.framework 1.0 19import org.kube.framework 1.0
22 20
23T.Button { 21AbstractButton {
24 id: root
25
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.buttonColor
39
40 border.width: 2
41 border.color: root.activeFocus && !root.pressed ? Colors.highlightColor : Colors.buttonColor
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 }
58} 22}