From bced09cd1f195c5fb8dde34efae1fd7835d0c59e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 5 Jan 2015 14:35:22 +0100 Subject: [PATCH] QmlDesigner.PropertyEditor: Fix control for saturation If the lightness or saturation are 0 then hue is undefined. If lightness is 0 then saturation is undefined/0. Nevertheless we should keep the old values in the ui, because the user should not loose the values in case he increases lightness or saturation later. Change-Id: I9fd80f6ca84fa08ef62d9fbb6dd4afce992c3546 Reviewed-by: Tim Jenssen --- .../HelperWidgets/ColorButton.qml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml index 6f0b0ef7cf5..8fe2ca171ae 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorButton.qml @@ -74,9 +74,17 @@ Item { block = true colorButton.color = Qt.hsla(hue, saturation, lightness, alpha); - hueSlider.value = hue - hueSlider2.value = hue - saturationSlider.value = saturation + + if (saturation > 0.0 && lightness > 0.0) { + hueSlider.value = hue + hueSlider2.value = hue + } + + if (lightness > 0.0) + saturationSlider.value = saturation + else + saturation = saturationSlider.value + lightnessSlider.value = lightness alphaSlider.value = alpha