-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.qml
67 lines (56 loc) · 1.56 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
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
// Import our custom QML component "MyDatabase", defined in main.cpp.
import org.mydb 1.0
Window {
id: window
title: Qt.application.name
width: 320
height: 180
visible: true
MyDatabase {
id: mydb
}
ColumnLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
spacing: 10
RowLayout {
Layout.fillWidth: true
TextField {
id: mInputText
Layout.fillWidth: true
focus: true
placeholderText: "1-10"
validator: IntValidator { bottom:0; top: 10 }
Keys.onReleased: {
console.log("key release event")
if(text.length > 0){
mButtonSearch.enabled = true
}
else {
mButtonSearch.enabled = false
}
}
}
Button {
id: mButtonSearch
text: "SEARCH"
enabled: false
onClicked: {
console.log("button click event")
mOutputText.text = mydb.search(mInputText.text)
}
}
}
Label {
id: mOutputText
text: "..."
Layout.alignment: Qt.AlignHCenter
}
}
}