-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
43 lines (38 loc) · 1.02 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
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Flow {
id: flow
anchors.margins: 10
anchors.fill: parent
spacing: 5
Repeater {
id: repeater
model: ListModel {id: modelTags}
TagLabel {
id: label
text: modelData
closeButton: true
onCloseClicked: {
for(var i = modelTags.count - 1; i >= 0; i--)
if(modelTags.get(i).text == text)
modelTags.remove(i)
}
}
}
TextInput {
text: "Type a tag here"
selectByMouse: true
color: activeFocus ? "black" : "gray"
onAccepted: {
modelTags.append({"text": text})
text = ""
}
onFocusChanged: if(focus) text = ""; else text = "Type a tag here";
}
}
}