Commit fb87aa97 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.PropertyEditor: Commit color string if selection changes

The LineEdit in the ColorEditor is not binded to a backendvalue
and we react manually to isAccepted (writeValueManually is set to true).

Because of this (and the famous focus bugs), we do not set the color,
if the selection is changed or the user enters edit mode without
pressing enter.

This patch adds the signal onCommitData to LineEdit and we react to
the signal. Because the the change of the backendvalue is delayed by
a timer we set the color immediately on the backend if we are not in gradient
editing mode.

Task-number: QTCREATORBUG-12841
Change-Id: Ic98640398c2c46b5e529780b4a9638c90760063f
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent b6e6e012
......@@ -50,6 +50,10 @@ Column {
property alias gradientPropertyName: gradientLine.gradientPropertyName
function isNotInGradientMode() {
return (buttonRow.checkedIndex !== 1)
}
onValueChanged: {
colorEditor.color = colorEditor.value
}
......@@ -78,7 +82,7 @@ Column {
gradientLine.currentColor = color
}
if (buttonRow.checkedIndex !== 1) {
if (isNotInGradientMode()) {
//Delay setting the color to keep ui responsive
colorEditorTimer.restart()
}
......@@ -170,6 +174,12 @@ Column {
colorEditor.color = colorFromString(textField.text)
}
onCommitData: {
colorEditor.color = colorFromString(textField.text)
if (isNotInGradientMode())
backendendValue.value = colorEditor.color
}
Layout.fillWidth: true
}
ColorCheckButton {
......
......@@ -53,6 +53,8 @@ Controls.TextField {
property bool showExtendedFunctionButton: true
signal commitData
ExtendedFunctionButton {
x: 2
y: 4
......@@ -82,7 +84,10 @@ Controls.TextField {
onSelectionToBeChanged: {
if (__dirty && !writeValueManually) {
lineEdit.backendValue.value = text
} else if (__dirty) {
commitData()
}
__dirty = false
}
}
......
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