From 502afc754beb50d12d35b2de34cf2c9d1c5f91d4 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Wed, 29 Sep 2021 12:16:19 +0200 Subject: [PATCH] QmlDesigner: Fix ColorEditor gradient controls Fix ColorEditor gradient controls not updating their value on changing the gradient or selecting another item containing a gradient. Task-number: QDS-5183 Change-Id: Icbec41f8db90f1e9c4ff0f3564ad6ed1df667f0f Reviewed-by: Thomas Hartmann --- .../imports/HelperWidgets/ColorEditor.qml | 14 ++++++++++++++ .../HelperWidgets/GradientPropertySpinBox.qml | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml index d07812f02fd..8006be8ffa1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml @@ -1075,6 +1075,20 @@ SecondColumnLayout { Layout.fillWidth: true spacing: 0 + Connections { + target: ceMode + function onActivated() { + spinBox.readValue() + } + } + + Connections { + target: modelNodeBackend + function onSelectionChanged() { + spinBox.readValue() + } + } + GradientPropertySpinBox { id: spinBox implicitWidth: StudioTheme.Values.controlGap diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml index a1c3251335c..65b6c14c73d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/GradientPropertySpinBox.qml @@ -45,6 +45,10 @@ Item { onFocusChanged: restoreCursor() + function readValue() { + spinBox.realValue = gradientLine.model.readGradientProperty(wrapper.propertyName) + } + StudioControls.RealSpinBox { id: spinBox @@ -56,9 +60,7 @@ Item { realStepSize: 1 decimals: 0 - Component.onCompleted: { - spinBox.realValue = gradientLine.model.readGradientProperty(wrapper.propertyName) - } + Component.onCompleted: wrapper.readValue() onCompressedRealValueModified: { gradientLine.model.setGradientProperty(wrapper.propertyName, spinBox.realValue) }