forked from qt-creator/qt-creator
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: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user