QML UI: autocomplete objects should lose focus on selection

When the user makes a selection using the autocomplete function while editing a dive the keyboard should close and the selection list should disappear.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
Joakim Bygdell 2017-07-31 15:55:30 +02:00 committed by Dirk Hohndel
parent 9e9e06aed6
commit 97f1dc0b01
2 changed files with 6 additions and 1 deletions

View file

@ -156,6 +156,7 @@ Item {
Kirigami.Label { Kirigami.Label {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: qsTr("Air Temp:") text: qsTr("Air Temp:")
font.pointSize: subsurfaceTheme.smallPointSize
} }
TextField { TextField {
id: txtAirTemp id: txtAirTemp

View file

@ -15,6 +15,7 @@ TextField {
textUpdateTimer.restart(); textUpdateTimer.restart();
} }
onFocusChanged: frame.shouldShow = focus onFocusChanged: frame.shouldShow = focus
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
focus = false focus = false
@ -27,6 +28,9 @@ TextField {
Keys.onDownPressed: { Keys.onDownPressed: {
hintsView.currentIndex++; hintsView.currentIndex++;
} }
Keys.onReturnPressed: {
focus = false
}
Timer { Timer {
id: textUpdateTimer id: textUpdateTimer
interval: 300 interval: 300
@ -107,7 +111,7 @@ TextField {
onClicked: { onClicked: {
hintsView.currentIndex = index hintsView.currentIndex = index
root.text = modelData root.text = modelData
frame.shouldShow = false; root.focus = false;
} }
} }
ScrollBar.vertical: ScrollBar { } ScrollBar.vertical: ScrollBar { }