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
This commit is contained in:
parent
12e0376fea
commit
3b87c6ea2d
1 changed files with 10 additions and 5 deletions
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue