Skip to content

Commit 893911d

Browse files
committed
qml: make ValueInput a focusable control and add visualFocus outline
1 parent 712cb36 commit 893911d

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/qml/controls/ValueInput.qml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77

8-
TextEdit {
8+
Control {
99
id: root
1010
required property string parentState
1111
property string description: ""
1212
property int descriptionSize: 18
1313
property color textColor
1414
state: root.parentState
15+
signal editingFinished()
16+
focusPolicy: Qt.StrongFocus
17+
18+
contentItem: TextEdit {
19+
font.family: "Inter"
20+
font.styleName: "Regular"
21+
font.pixelSize: root.descriptionSize
22+
color: root.textColor
23+
text: root.description
24+
horizontalAlignment: Text.AlignRight
25+
wrapMode: Text.WordWrap
26+
onEditingFinished: editingFinished()
27+
}
1528

1629
states: [
1730
State {
@@ -28,15 +41,17 @@ TextEdit {
2841
}
2942
]
3043

31-
font.family: "Inter"
32-
font.styleName: "Regular"
33-
font.pixelSize: root.descriptionSize
34-
color: root.textColor
35-
text: description
36-
horizontalAlignment: Text.AlignRight
37-
wrapMode: Text.WordWrap
38-
39-
Behavior on color {
44+
Behavior on textColor {
4045
ColorAnimation { duration: 150 }
4146
}
47+
48+
background: Rectangle {
49+
visible: root.visualFocus
50+
anchors.fill: parent
51+
anchors.margins: -4
52+
border.width: 2
53+
border.color: Theme.color.purple
54+
radius: 9
55+
color: "transparent"
56+
}
4257
}

0 commit comments

Comments
 (0)