-
Notifications
You must be signed in to change notification settings - Fork 0
/
HopDialog.qml
75 lines (70 loc) · 1.92 KB
/
HopDialog.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.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import automash 1.0
Dialog {
id: dialog
signal finished(string name, double amount, string time)
function create() {
name.text = ""
amount.text = ""
time.text = ""
dialog.title = qsTr("Add Hop")
dialog.open()
name.focus = true
}
function edit(hop) {
name.text = hop.name
amount.text = hop.amount
time.text = hop.time
dialog.title = qsTr("Edit Hop")
dialog.open()
name.focus = true
}
modality: Qt.WindowModal
standardButtons: StandardButton.Ok | StandardButton.Cancel | StandardButton.Apply
ColumnLayout {
//columns: 2
anchors.fill: parent
RowLayout {
Layout.fillWidth: true
Label {
text: "Hop:"
}
TextField {
id: name
placeholderText: "Name"
horizontalAlignment: TextInput.AlignRight
Layout.fillWidth: true
}
}
RowLayout {
Layout.fillWidth: true
Label {
text: "Amount(oz):"
}
TextField {
id: amount
placeholderText: "10"
horizontalAlignment: TextInput.AlignRight
Layout.fillWidth: true
inputMethodHints: Qt.ImhDigitsOnly
}
}
RowLayout {
Layout.fillWidth: true
Label {
text: "Time(minutes):"
}
TextField {
id: time
placeholderText: "10"
horizontalAlignment: TextInput.AlignRight
Layout.fillWidth: true
inputMethodHints: Qt.ImhDigitsOnly
}
}
}
onAccepted: finished(name.text, amount.text, time.text)
}