1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-31 02:01:19 +00:00

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.
This commit is contained in:
Vincent Wong 2016-04-07 18:15:37 -07:00
parent cc57fbdcd5
commit e94801ee02

View File

@ -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)
}
}
}