diff options
Diffstat (limited to 'framework/qml')
-rw-r--r-- | framework/qml/AbstractButton.qml | 38 | ||||
-rw-r--r-- | framework/qml/Button.qml | 38 | ||||
-rw-r--r-- | framework/qml/PositiveButton.qml | 41 |
3 files changed, 34 insertions, 83 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 | } |
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 | ||
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 | ||
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 | } |
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 | } |