diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-04-06 12:58:53 +0200 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-04-06 12:58:53 +0200 |
commit | 872bb7b30eeba9147f7b029fd88456679eb9f854 (patch) | |
tree | b2e185e7f7f6b53a9e9b3c76b57c143d6941126a | |
parent | bc545b0a3720110352900d472ba561e4d874c810 (diff) | |
download | kube-872bb7b30eeba9147f7b029fd88456679eb9f854.tar.gz kube-872bb7b30eeba9147f7b029fd88456679eb9f854.zip |
base PositiveButton on controls templates
-rw-r--r-- | framework/qml/PositiveButton.qml | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/framework/qml/PositiveButton.qml b/framework/qml/PositiveButton.qml index 9e23ee5d..f526968b 100644 --- a/framework/qml/PositiveButton.qml +++ b/framework/qml/PositiveButton.qml | |||
@@ -16,32 +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.Controls 2.0 as Controls | 20 | import QtQuick.Templates 2.1 as T |
21 | import org.kube.framework 1.0 as Kube | 21 | import org.kube.framework 1.0 |
22 | 22 | ||
23 | Controls.AbstractButton { | 23 | T.Button { |
24 | id: root | 24 | id: root |
25 | 25 | ||
26 | width: mainText.implicitWidth + Kube.Units.largeSpacing * 2 | 26 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) |
27 | height: mainText.implicitHeight + Kube.Units.smallSpacing * 2 | 27 | height: contentItem.implicitHeight + Units.smallSpacing * 2 |
28 | 28 | ||
29 | clip: true | 29 | padding: Units.largeSpacing |
30 | topPadding: Units.smallSpacing * 2 | ||
31 | bottomPadding: Units.smallSpacing *2 | ||
30 | 32 | ||
31 | Rectangle { | 33 | clip: true |
32 | id: background | 34 | hoverEnabled: true |
33 | 35 | ||
34 | anchors.fill: parent | 36 | background: Rectangle { |
37 | color: root.pressed ? Colors.highlightColor : Colors.positveColor | ||
35 | 38 | ||
36 | color: Kube.Colors.positveColor | 39 | Rectangle { |
40 | anchors.fill: parent | ||
41 | visible: root.hovered | ||
42 | color: Colors.viewBackgroundColor | ||
43 | opacity: 0.1 | ||
44 | } | ||
37 | } | 45 | } |
38 | 46 | ||
39 | Text { | 47 | contentItem: Text { |
40 | id: mainText | ||
41 | |||
42 | anchors.centerIn: parent | ||
43 | |||
44 | color: Kube.Colors.highlightedTextColor | ||
45 | text: root.text | 48 | text: root.text |
49 | //TODO font | ||
50 | elide: Text.ElideRight | ||
51 | horizontalAlignment: Text.AlignHCenter | ||
52 | verticalAlignment: Text.AlignVCenter | ||
53 | color: Colors.highlightedTextColor | ||
46 | } | 54 | } |
47 | } | 55 | } |