-
Notifications
You must be signed in to change notification settings - Fork 12
/
SearchInput.qml
40 lines (32 loc) · 894 Bytes
/
SearchInput.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
import QtQuick 1.1
Item {
id: searchItem; objectName: "searchInput"
width: parent.width; height: 30
signal queryChanged(string query)
BorderImage {
source: "assets/imgs/lineedit.sci"
anchors.fill: parent
}
TextInput {
id: input
horizontalAlignment: TextEdit.AlignLeft
font.pixelSize: 16; font.bold: true; color: "black"
anchors {
left: parent.left; right: parent.right; leftMargin: 18; rightMargin: 18
verticalCenter: parent.verticalCenter
}
onTextChanged: timer.start()
onAccepted: {
searchItem.queryChanged(text)
timer.stop();
}
}
Timer {
id: timer
interval: 300; running: false; repeat: true
onTriggered: {
searchItem.queryChanged(input.text)
timer.stop();
}
}
}