-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
101 lines (87 loc) · 2.44 KB
/
main.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
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
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
ApplicationWindow {
title: qsTr("A real form")
width: 640
height: 480
Component.onCompleted: form.forceActiveFocus()
FForm {
id: form
anchors {
fill: parent
}
onAccepted: {
var surname = surnameInput.text
var name = nameInput.text
var phone = phoneInput.text
var lang = langInput.currentText
console.log("Surname: '" + surname + "'")
console.log("Name: '" + name + "'")
console.log("Phone: '" + phone + "'")
console.log("Language: '" + lang + "'")
console.log("Time: '" + (new Date()).toLocaleString() + "'")
}
onRejected: {
console.warn("You are not done yet.")
}
Column {
anchors {
fill: parent
margins: 15
}
Row {
FLabel {
text: qsTr("Surname")
target: surnameInput
width: 80
}
FTextField {
id: surnameInput
width: 200
}
}
Row {
FLabel {
text: qsTr("Name")
target: nameInput
width: 80
}
FTextField {
id: nameInput
width: 200
}
}
Row {
FLabel {
text: qsTr("Phone")
target: phoneInput
width: 80
}
FTextField {
id: phoneInput
width: 200
validator: RegExpValidator {
regExp: /^(\+)?[-. 0-9]{9,12}$/
}
}
}
Row {
FLabel {
text: qsTr("Language")
target: langInput
width: 80
}
FComboBox {
id: langInput
model: ['en', 'fr', 'es', 'de']
}
}
Row {
anchors.right: parent.right
FClearButton { }
FSubmitButton { }
}
}
}
}