summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2014-08-15 13:52:39 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2014-08-21 14:23:55 +0200
commitfb87aa97bd162b482a9eb67fe24c7059d5c13bfd (patch)
treec87acb60aaf8dca867b369dc597a0365dfee6b26
parentb6e6e0123c0a442ffd7b8bcafb1e13567979e2fb (diff)
downloadqt-creator-fb87aa97bd162b482a9eb67fe24c7059d5c13bfd.tar.gz
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>
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml12
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml5
2 files changed, 16 insertions, 1 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml
index aa4b76edfe..6fe7636fad 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml
@@ -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 {
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml
index 9cea91a9e5..1f5dd2aad7 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml
@@ -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
}
}