-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.qml
More file actions
126 lines (94 loc) · 3.52 KB
/
main.qml
File metadata and controls
126 lines (94 loc) · 3.52 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import QtQuick 2.0
Rectangle {
id: root
signal runCommand(string cmd);
signal hideView();
signal quitClicked()
property int padding: 20
property int minButtonWidth: 60
property int minButtonHeight: 40
property int buttonWidth: Math.ceil(
(width - padding*2) /
(minButtonWidth*8)) *
minButtonWidth
property int buttonHeight: Math.ceil(
(width - padding*2) /
(minButtonWidth*8)) *
minButtonHeight
property int cellWidth: buttonWidth + padding/2
property int cellHeight: buttonHeight + padding/2
property string buttonColor: "#000000"
property string buttonColorToggled: "#552222"
property int fontSize: Math.ceil(
(width - padding*2) /
(minButtonWidth*8)) * 8
width: 1366
height: 768
color: "#555555"
Flickable {
id: flick
anchors.fill: parent
anchors.margins: padding
interactive: false
contentHeight: contentColumn.height
Column {
id: contentColumn
spacing: 10
anchors.horizontalCenter: parent.horizontalCenter
width: Math.floor(
(parent.width - padding*2) / root.cellWidth) *
root.cellWidth
ListView {
id: rows
model: Buttons {}
width: parent.width
height: model.count * root.cellHeight
spacing: 5
interactive: false
delegate: GridView {
id: grid
model: elements
interactive: false
width: parent.width
height: Math.ceil(model.count *
cellWidth / width) *
cellHeight
property bool stretchElements:
model.count * root.cellWidth - parent.width < 0
cellWidth: stretchElements ?
Math.floor(parent.width / model.count) :
root.cellWidth
cellHeight: root.cellHeight
delegate: Loader {
width: grid.cellWidth - padding/2
height: root.buttonHeight
source: (type === "toggle") ? "ToggleButton.qml" :
(type === "slider") ? "Slider.qml" :
(type === "confirm") ? "ConfirmButton.qml" :
"NormalButton.qml"
}
}
}
Row {
id: quitButtons
height: root.buttonHeight
y: contentColumn.height < flick.height ?
flick.height - height :
rows.height
spacing: 10
Button {
width: root.buttonWidth
height: parent.height
text: "Quit"
onClicked: Qt.quit()
}
Button {
width: root.buttonWidth
height: parent.height
text: "Hide"
onClicked: root.hideView()
}
}
}
}
}