diff options
Diffstat (limited to 'framework/qml/Button.qml')
-rw-r--r-- | framework/qml/Button.qml | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/framework/qml/Button.qml b/framework/qml/Button.qml index a2be7136..44e36e34 100644 --- a/framework/qml/Button.qml +++ b/framework/qml/Button.qml | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | 2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -16,43 +16,40 @@ | |||
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 | 19 | import QtQuick 2.8 |
20 | import QtQuick.Templates 2.1 as T | ||
21 | import org.kube.framework 1.0 | ||
20 | 22 | ||
21 | import org.kube.framework 1.0 as Kube | 23 | T.Button { |
22 | |||
23 | Rectangle { | ||
24 | id: root | 24 | id: root |
25 | 25 | ||
26 | signal clicked() | 26 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) |
27 | property alias text: text.text | 27 | height: contentItem.implicitHeight + Units.smallSpacing * 2 |
28 | property color textColor: Kube.Colors.highlightedTextColor | 28 | |
29 | property string iconName: "" | 29 | padding: Units.largeSpacing |
30 | property alias implicitHeight: content.implicitHeight | 30 | topPadding: Units.smallSpacing * 2 |
31 | property alias implicitWidth: content.implicitWidth | 31 | bottomPadding: Units.smallSpacing *2 |
32 | width: implicitWidth | ||
33 | height: implicitHeight | ||
34 | 32 | ||
35 | clip: true | 33 | clip: true |
34 | hoverEnabled: true | ||
36 | 35 | ||
37 | Row { | 36 | background: Rectangle { |
38 | id: content | 37 | color: root.pressed ? Colors.highlightColor : Colors.buttonColor |
39 | anchors.centerIn: parent | 38 | |
40 | spacing: Kube.Units.smallSpacing | 39 | Rectangle { |
41 | Text { | 40 | anchors.fill: parent |
42 | id: text | 41 | visible: root.hovered |
43 | anchors.verticalCenter: parent.verticalCenter | 42 | color: Colors.viewBackgroundColor |
44 | color: root.textColor | 43 | opacity: 0.1 |
45 | } | ||
46 | Icon { | ||
47 | id: icon | ||
48 | anchors.verticalCenter: parent.verticalCenter | ||
49 | iconName: root.iconName | ||
50 | visible: iconName != "" | ||
51 | } | 44 | } |
52 | } | 45 | } |
53 | 46 | ||
54 | MouseArea { | 47 | contentItem: Text { |
55 | anchors.fill: parent | 48 | text: root.text |
56 | onClicked: root.clicked() | 49 | //TODO font |
50 | elide: Text.ElideRight | ||
51 | horizontalAlignment: Text.AlignHCenter | ||
52 | verticalAlignment: Text.AlignVCenter | ||
53 | color: Colors.textColor | ||
57 | } | 54 | } |
58 | } | 55 | } |