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 <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2021-09-29 12:16:19 +02:00
committed by Henning Gründl
parent 969d659713
commit 502afc754b
2 changed files with 19 additions and 3 deletions

View File

@@ -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

View File

@@ -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)
}