diff --git a/qml/widgets/InplaceEditText.qml b/qml/widgets/InplaceEditText.qml index 7122603d..ea0403f4 100644 --- a/qml/widgets/InplaceEditText.qml +++ b/qml/widgets/InplaceEditText.qml @@ -49,13 +49,23 @@ ColumnLayout { font.pixelSize: lbl.font.pixelSize horizontalAlignment: Text.AlignHCenter + onActiveFocusChanged: { + if (!activeFocus) { + save() + } + } + Keys.onReturnPressed: { if (event.modifiers == Qt.NoModifier) { - root.text = txt.text - txt.visible = false - lbl.visible = true - root.updated(txt.text) + save() } } + + function save() { + root.text = txt.text + txt.visible = false + lbl.visible = true + root.updated(txt.text) + } } } \ No newline at end of file