diff options
author | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-07-28 15:35:40 +0200 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-07-28 18:29:40 +0200 |
commit | 2dd9a0cc218f5bd6856c86e8b5d405c1214c9b73 (patch) | |
tree | b80854fdf58ee0b4fe40ab31a98517f11774ce07 /share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets | |
parent | e4189136ac342e50507b1d937f1079eaa222d1c4 (diff) | |
download | qt-creator-2dd9a0cc218f5bd6856c86e8b5d405c1214c9b73.tar.gz |
QmlDesigner.PropertyEditor: Fix selection in gradient editing
Since property change signals can be emitted in any order we have to rely
on selection changed signals to guarantee a valid state.
I use the isInValidState which is only true after all properties have been
setup correctly after a selection change for this.
I added the signal selectionChanged for this.
Task-number: QTCREATORBUG-12642
Task-number: QTCREATORBUG-12506
Change-Id: Idf3bbe8236ece541ca267efb1bd68e0737c99716
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets')
-rw-r--r-- | share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml index 37696f8eb1..aa4b76edfe 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml @@ -62,6 +62,7 @@ Column { id: colorEditorTimer repeat: false interval: 100 + running: false onTriggered: { if (backendendValue !== undefined) backendendValue.value = colorEditor.color @@ -69,21 +70,22 @@ Column { } onColorChanged: { - if (!gradientLine.isCompleted) + if (!gradientLine.isInValidState) return; if (supportGradient && gradientLine.hasGradient) { - gradientLine.currentColor = color textField.text = convertColorToString(color) + gradientLine.currentColor = color } - if (buttonRow.checkedIndex !== 1) + if (buttonRow.checkedIndex !== 1) { //Delay setting the color to keep ui responsive colorEditorTimer.restart() + } } GradientLine { - property bool isCompleted: false + property bool isInValidState: false visible: buttonRow.checkedIndex === 1 id: gradientLine @@ -110,18 +112,23 @@ Column { Connections { target: modelNodeBackend + onSelectionToBeChanged: { + colorEditorTimer.stop() + gradientLine.isInValidState = false + } + } + + Connections { + target: modelNodeBackend onSelectionChanged: { if (supportGradient && gradientLine.hasGradient) { colorEditor.color = gradientLine.currentColor - } else { - colorEditor.color = colorEditor.value + gradientLine.currentColor = color } + gradientLine.isInValidState = true } } - Component.onCompleted: { - isCompleted= true - } } SectionLayout { |