diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-23 19:03:49 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-23 19:03:49 +0200 |
commit | a3f1e799e269eaecad0b380534764f098b071560 (patch) | |
tree | 02275c8226d35a1172c8ae5014a14b97e55d232d /framework | |
parent | 519fa9c2874814569743d0473e68c26c009d66c1 (diff) | |
download | kube-a3f1e799e269eaecad0b380534764f098b071560.tar.gz kube-a3f1e799e269eaecad0b380534764f098b071560.zip |
Use a TextButton instead
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/TextButton.qml | 43 | ||||
-rw-r--r-- | framework/qmldir | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/framework/qml/TextButton.qml b/framework/qml/TextButton.qml new file mode 100644 index 00000000..4d7ea27d --- /dev/null +++ b/framework/qml/TextButton.qml | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * | ||
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 | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Templates 2.0 as T | ||
21 | import org.kube.framework 1.0 | ||
22 | |||
23 | T.Button { | ||
24 | id: root | ||
25 | |||
26 | property alias color: label.color | ||
27 | |||
28 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | ||
29 | height: contentItem.implicitHeight + topPadding + bottomPadding | ||
30 | |||
31 | clip: true | ||
32 | hoverEnabled: true | ||
33 | Keys.onReturnPressed: root.clicked() | ||
34 | |||
35 | contentItem: Label { | ||
36 | id: label | ||
37 | text: root.text | ||
38 | font.underline: root.activeFocus || root.hovered | ||
39 | elide: Text.ElideRight | ||
40 | horizontalAlignment: Text.AlignHCenter | ||
41 | verticalAlignment: Text.AlignVCenter | ||
42 | } | ||
43 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 0a71b6c8..156cdb07 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -20,6 +20,7 @@ ProgressBar 1.0 ProgressBar.qml | |||
20 | StatusBar 1.0 StatusBar.qml | 20 | StatusBar 1.0 StatusBar.qml |
21 | ComboBox 1.0 ComboBox.qml | 21 | ComboBox 1.0 ComboBox.qml |
22 | PositiveButton 1.0 PositiveButton.qml | 22 | PositiveButton 1.0 PositiveButton.qml |
23 | TextButton 1.0 TextButton.qml | ||
23 | TextField 1.0 TextField.qml | 24 | TextField 1.0 TextField.qml |
24 | TextArea 1.0 TextArea.qml | 25 | TextArea 1.0 TextArea.qml |
25 | TextEditor 1.0 TextEditor.qml | 26 | TextEditor 1.0 TextEditor.qml |