-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextCell.qml
59 lines (52 loc) · 1.46 KB
/
TextCell.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
import QtCharts 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
Rectangle {
implicitWidth: 128
implicitHeight: holeLabel.implicitHeight
color: row % 2 == 0 ? "#f2f2f2" : "#ffffff"
Label {
id: holeLabel
anchors { verticalCenter: parent.verticalCenter; left: parent.left }
padding: 4
text: display
}
MouseArea {
anchors.fill: parent
onClicked: {
holeLoader.visible = true
holeLoader.item.forceActiveFocus()
}
}
Loader {
id: holeLoader
anchors { verticalCenter: parent.verticalCenter; left: parent.left}
height: parent.height
width: parent.width
visible: false
sourceComponent: visible ? holeInput : undefined
Component {
id: holeInput
TextField {
anchors { fill: parent }
text: display
onEditingFinished:{
edit = text
holeLoader.visible = false
}
Keys.onPressed: {
if (event.key == Qt.Key_Escape) {
focus = false
event.accepted = true;
}
}
onActiveFocusChanged: {
if (!activeFocus) {
holeLoader.visible = false
}
}
}
}
}
}