Commit 10e2a046 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.PropertyEditor: Adding dirty flag to LineEdit

This patch ensures that we only commit data to the backend
if the text actually changed. The signal onEditingFinished is triggered
even if the user did not edit the string.

Change-Id: I2d54f3d79a1c60525e4c9744b364cc014bd407ce
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 317fe1f4
......@@ -49,6 +49,8 @@ Controls.TextField {
property bool hasToConvertColor: false
property bool __dirty: false
ExtendedFunctionButton {
x: 2
y: 4
......@@ -65,20 +67,28 @@ Controls.TextField {
} else {
lineEdit.text = valueFromBackend
}
__dirty = false
}
}
onTextChanged: {
__dirty = true
}
onEditingFinished: {
if (hasToConvertColor)
return
if (!__dirty)
return
if (backendValue.isTranslated) {
backendValue.expression = "qsTr(\"" + trCheckbox.escapeString(text) + "\")"
} else {
if (lineEdit.backendValue.value !== text)
lineEdit.backendValue.value = text;
}
__dirty = false
}
style: TextFieldStyle {
......
Markdown is supported
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