Commit 3b87c6ea authored by Ismael Asensio's avatar Ismael Asensio
Browse files

kcm/kwinrules: Update values on text edit

Previously the text values were updated to the model after
`onEditingFinished()`, that is after losing focus, to prevent
erroneus updates.

This was making also the `needsSaving` signal fire only after
a focus change, which is not consistent with the behavior of
other KCMs.

Use `onTextEdit()` instead, so the model is updated as the user
types.

BUG: 431211
parent 12e0376f
......@@ -68,14 +68,19 @@ Loader {
Component {
id: stringEditor
QQC2.TextField {
id: stringTextField
property bool isTextEdited: false
text: ruleValue
horizontalAlignment: Text.AlignLeft
onTextEdited: { isTextEdited = true; }
onEditingFinished: {
if (isTextEdited) { valueEditor.valueEdited(text); }
isTextEdited = false;
onTextEdited: { valueEditor.valueEdited(text); }
Connections {
target: valueEditor
function onRuleValueChanged() {
if (!stringTextField.activeFocus) { // Protects from self-updating when editing
stringTextField.text = valueEditor.ruleValue
}
}
}
Component.onCompleted: { this.text = valueEditor.ruleValue }
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment