This repository has been archived by the owner on Jan 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDialogButton.qml
75 lines (62 loc) · 2.2 KB
/
DialogButton.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import QtQuick 2.3
import "Theme.js" as Theme;
Rectangle {
id: btn;
property alias title: primaryText.text;
property alias subtitle: tertiaryText.text
property alias icon: iconImage.source
signal clicked();
height: 3 * Theme.marginSmall + primaryText.paintedHeight + tertiaryText.paintedHeight;
anchors.left: parent.left;
anchors.right: parent.right;
// height: Theme.tertiary_pointSize + 2 * Theme.margin
color: m.pressed ? Theme.background_color_pressed : Theme.background_color
Image {
id: iconImage;
anchors.left: parent.left;
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.margin
anchors.rightMargin: Theme.margin
}
Text {
id: primaryText
anchors.topMargin: Theme.marginSmall
anchors.leftMargin: Theme.margin
anchors.rightMargin: Theme.margin
anchors.top: (tertiaryText.text !== "") ? parent.top : undefined;
anchors.verticalCenter: (tertiaryText.text === "") ? parent.verticalCenter: undefined;
anchors.left: (iconImage.status === Image.Null) ? parent.left : iconImage.right;
anchors.right: parent.right
wrapMode: Text.WordWrap
color: m.pressed ? Theme.primary_color_highlight : Theme.primary_color
font.pointSize: Theme.primary_pointSize
}
Text {
id: tertiaryText
anchors.top: primaryText.bottom
anchors.left: (iconImage.status === Image.Null) ? parent.left : iconImage.right;
anchors.right: parent.right
anchors.topMargin: Theme.marginSmall
anchors.leftMargin: Theme.margin
anchors.rightMargin: Theme.margin
wrapMode: Text.WordWrap
font.pointSize: Theme.tertiary_pointSize
text: ""
color: m.pressed ? Theme.tertiary_color_highlight : Theme.tertiary_color
}
MouseArea {
id: m;
anchors.fill: parent;
onClicked: {
btn.clicked()
}
}
// Rectangle {
// id: secondaryAction
// color: "#ff0000";
// width: parent.height;
// height: parent.height;
// anchors.right: parent.right
// anchors.verticalCenter: parent.verticalCenter
// }
}