From e94801ee024c0ac127aaa44a604fd86d52cf85f1 Mon Sep 17 00:00:00 2001 From: Vincent Wong Date: Thu, 7 Apr 2016 18:15:37 -0700 Subject: [PATCH] Fix issue with custom command not saving on exit If the user directly closes the settings window without triggering the custom command Textfield's onEditingFinished (via unfocus or pressing enter), the custom command may not save. This change adds a listener to the Textfield so that if the settings window closes, the change will always be recorded. --- app/qml/SettingsGeneralTab.qml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/qml/SettingsGeneralTab.qml b/app/qml/SettingsGeneralTab.qml index 82d386d..5c10dd9 100644 --- a/app/qml/SettingsGeneralTab.qml +++ b/app/qml/SettingsGeneralTab.qml @@ -171,7 +171,7 @@ Tab{ checked: appSettings.useCustomCommand onCheckedChanged: appSettings.useCustomCommand = checked } - // workaround for QTBUG-31627 for pre 5.3.0 + // Workaround for QTBUG-31627 for pre 5.3.0 Binding{ target: useCustomCommand property: "checked" @@ -179,10 +179,16 @@ Tab{ } TextField{ id: customCommand + anchors {left: parent.left; right: parent.right} text: appSettings.customCommand enabled: useCustomCommand.checked onEditingFinished: appSettings.customCommand = text - anchors {left: parent.left; right: parent.right} + + // Save text even if user forgets to press enter or unfocus + function saveSetting() { + appSettings.customCommand = text; + } + Component.onCompleted: settings_window.closing.connect(saveSetting) } } }