diff options
6 files changed, 32 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 { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index c4969943a5..1207514ecf 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -443,6 +443,11 @@ void PropertyEditorQmlBackend::emitSelectionToBeChanged() m_backendModelNode.emitSelectionToBeChanged(); } +void PropertyEditorQmlBackend::emitSelectionChanged() +{ + m_backendModelNode.emitSelectionChanged(); +} + QUrl PropertyEditorQmlBackend::getQmlUrlForModelNode(const ModelNode &modelNode, TypeName &className) { if (modelNode.isValid()) { diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h index e79caab56a..acc7571cac 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h @@ -75,6 +75,7 @@ public: static bool checkIfUrlExists(const QUrl &url); void emitSelectionToBeChanged(); + void emitSelectionChanged(); private: void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode, diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 46e80c9238..25eed26b02 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -347,6 +347,9 @@ void PropertyEditorView::resetView() setupQmlBackend(); + if (m_qmlBackEndForCurrentType) + m_qmlBackEndForCurrentType->emitSelectionChanged(); + m_locked = false; if (m_timerId) diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp index 58e1d71e9e..a662970b59 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp @@ -55,6 +55,11 @@ void QmlModelNodeProxy::emitSelectionToBeChanged() emit selectionToBeChanged(); } +void QmlModelNodeProxy::emitSelectionChanged() +{ + selectionChanged(); +} + QmlItemNode QmlModelNodeProxy::qmlItemNode() const { return m_qmlItemNode; diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h index 3bdb2b84c7..06cc93ba32 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h +++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.h @@ -50,6 +50,7 @@ public: static void registerDeclarativeType(); void emitSelectionToBeChanged(); + void emitSelectionChanged(); QmlItemNode qmlItemNode() const; @@ -58,6 +59,7 @@ public: signals: void modelNodeChanged(); void selectionToBeChanged(); + void selectionChanged(); public slots: |