blob: 700f3a79ab846026204b72f59d0005ba50b04d4a (
plain) (
blame)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
import QtQuick 2.7
import QtQuick.Window 2.2
Window {
id:root
visible: true
signal addRoll(string name, string cmd )
signal roll(string cmd)
color: "black"
height: 1280
width: 720
Column{
anchors.fill: parent
leftPadding: width*0.025
rightPadding: width*0.025
topPadding: width*0.025
Rectangle {
height: parent.height*0.12
width: parent.width*0.95
Image {
anchors.fill: parent
horizontalAlignment: Image.AlignHCenter
verticalAlignment:Image.AlignVCenter
fillMode: Image.PreserveAspectFit
source: "qrc:/resources/images/add.png"
}
gradient: Gradient {
GradientStop { position: 0.0; color: "darkblue" }
GradientStop { position: 1.0; color: "blue" }
}
MouseArea {
anchors.fill: parent
onClicked:popupAdd.visible = true
}
}
ListView {
model: _model
focus: true
height: parent.height*0.88
width: parent.width*0.95
delegate: Item{
height: parent.height
width: parent.width
Column{
width: parent.width
height: parent.height
Text{
text: name
font.pointSize: 40
color: "white"
}
Text{
text: cmd
font.pointSize:30
color: "white"
}
}
MouseArea{
anchors.fill:parent
onClicked: roll(cmd)
}
}
}
}
Rectangle {
id: popupAdd
color: "black"
x: parent.width*0.1
y: parent.height*0.1
height: parent.height*0.80
width: parent.width*0.80
visible: false
border.color: "white"
border.width: 1
Column{
id:form
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: parent.height*0.80
leftPadding: width*0.025
rightPadding: width*0.025
topPadding: width*0.025
property alias name : nameInp
property alias cmd : cmdInp
Text {
text: qsTr("Name")
color: "white"
height: parent.height*0.1
font.pointSize: 40
}
Rectangle{
height: parent.height*0.1
width: parent.width*0.90
border.color: "#BBBBBB"
border.width: 1
color: "black"
TextInput{
id: nameInp
color: "white"
anchors.fill: parent
font.pointSize: 40
}
}
Text {
text: qsTr("Command")
color: "white"
height: parent.height*0.1
font.pointSize: 40
}
Rectangle{
height: parent.height*0.1
width: parent.width*0.90
border.color: "#BBBBBB"
border.width: 1
color: "black"
TextInput{
id: cmdInp
color: "white"
anchors.fill: parent
font.pointSize: 40
}
}
}
Rectangle {
color:"red"
id: cancel
anchors.top: form.bottom
anchors.left: form.left
anchors.right: form.horizontalCenter
anchors.bottom: parent.bottom
radius: height/2
MouseArea {
anchors.fill: parent
onClicked:{
nameInp.text=""
cmdInp.text=""
popupAdd.visible = false
}
}
}
Rectangle {
color:"green"
anchors.top: form.bottom
anchors.left: cancel.right
anchors.right: form.right
anchors.bottom: parent.bottom
radius: height/2
MouseArea {
anchors.fill: parent
onClicked:
{
root.addRoll(nameInp,cmdInp.text);
nameInp.text=""
cmdInp.text=""
popupAdd.visible = false
}
}
}
}
}
|