diff options
-rw-r--r-- | framework/qml/AbstractButton.qml | 51 | ||||
-rw-r--r-- | framework/qml/People.qml | 4 | ||||
-rw-r--r-- | framework/qmldir | 1 |
3 files changed, 53 insertions, 3 deletions
diff --git a/framework/qml/AbstractButton.qml b/framework/qml/AbstractButton.qml new file mode 100644 index 00000000..a92ab5df --- /dev/null +++ b/framework/qml/AbstractButton.qml | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Templates 2.0 as T | ||
22 | import org.kube.framework 1.0 | ||
23 | |||
24 | T.Button { | ||
25 | id: root | ||
26 | |||
27 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | ||
28 | height: contentItem.implicitHeight + Units.smallSpacing * 2 | ||
29 | |||
30 | padding: Units.largeSpacing | ||
31 | topPadding: Units.smallSpacing * 2 | ||
32 | bottomPadding: Units.smallSpacing *2 | ||
33 | |||
34 | clip: true | ||
35 | hoverEnabled: true | ||
36 | Keys.onReturnPressed: root.clicked() | ||
37 | |||
38 | background: Rectangle { | ||
39 | color: Colors.buttonColor | ||
40 | |||
41 | border.width: 2 | ||
42 | border.color: root.activeFocus && !root.pressed ? Colors.highlightColor : Colors.buttonColor | ||
43 | |||
44 | Rectangle { | ||
45 | anchors.fill: parent | ||
46 | visible: root.hovered || root.pressed | ||
47 | color: root.pressed ? Colors.textColor : Colors.viewBackgroundColor | ||
48 | opacity: 0.2 | ||
49 | } | ||
50 | } | ||
51 | } | ||
diff --git a/framework/qml/People.qml b/framework/qml/People.qml index bdb2cdf2..c2c6c9ef 100644 --- a/framework/qml/People.qml +++ b/framework/qml/People.qml | |||
@@ -134,15 +134,13 @@ FocusScope { | |||
134 | filter: searchBar.text | 134 | filter: searchBar.text |
135 | } | 135 | } |
136 | 136 | ||
137 | //TODO using Kube.Button currently crashes, but shouldn't | 137 | delegate: Kube.AbstractButton { |
138 | delegate: Button { | ||
139 | id: delegateRoot | 138 | id: delegateRoot |
140 | 139 | ||
141 | height: Kube.Units.gridUnit * 3 | 140 | height: Kube.Units.gridUnit * 3 |
142 | width: Kube.Units.gridUnit * 10 | 141 | width: Kube.Units.gridUnit * 10 |
143 | 142 | ||
144 | activeFocusOnTab: true | 143 | activeFocusOnTab: true |
145 | Keys.onReturnPressed: delegateRoot.clicked() | ||
146 | 144 | ||
147 | onClicked: { | 145 | onClicked: { |
148 | root.currentContact = model.domainObject | 146 | root.currentContact = model.domainObject |
diff --git a/framework/qmldir b/framework/qmldir index 1a888068..a23e2475 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -15,6 +15,7 @@ People 1.0 People.qml | |||
15 | NotificationPopup 1.0 NotificationPopup.qml | 15 | NotificationPopup 1.0 NotificationPopup.qml |
16 | Icon 1.0 Icon.qml | 16 | Icon 1.0 Icon.qml |
17 | IconButton 1.0 IconButton.qml | 17 | IconButton 1.0 IconButton.qml |
18 | AbstractButton 1.0 AbstractButton.qml | ||
18 | Button 1.0 Button.qml | 19 | Button 1.0 Button.qml |
19 | Popup 1.0 Popup.qml | 20 | Popup 1.0 Popup.qml |
20 | ProgressBar 1.0 ProgressBar.qml | 21 | ProgressBar 1.0 ProgressBar.qml |