From 4c4e90062c071005d8dd5aaab09a952054301ffc Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Mon, 12 Feb 2024 18:45:05 +0200 Subject: [PATCH] QmlDesigner: Update the value of the color picker for CollectionEditor Fixes: QDS-11796 Change-Id: Iaf3f6bc06771f461c4119d55ae3c3a294d3d8564 Reviewed-by: Miikka Heikkinen Reviewed-by: Qt CI Patch Build Bot --- .../ColorViewDelegate.qml | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/qmldesigner/collectionEditorQmlSource/ColorViewDelegate.qml b/share/qtcreator/qmldesigner/collectionEditorQmlSource/ColorViewDelegate.qml index 1414a2dd3a2..6bb1b60159a 100644 --- a/share/qtcreator/qmldesigner/collectionEditorQmlSource/ColorViewDelegate.qml +++ b/share/qtcreator/qmldesigner/collectionEditorQmlSource/ColorViewDelegate.qml @@ -42,6 +42,19 @@ Row { property bool __block: false + function getColorFromEditValue() { + if (!edit) + return "white" // default color for Rectangle + + if (colorEditor.isVector3D) { + return Qt.rgba(__editColor.x, + __editColor.y, + __editColor.z, 1) + } + + return __editColor + } + function resetShapeColor() { if (edit) edit = "" @@ -64,7 +77,7 @@ Row { // Syncing color from backend to frontend and block reflection function syncColor() { colorEditor.__block = true - colorEditor.color = colorEditor.value + colorEditor.color = colorEditor.getColorFromEditValue() hexTextField.syncColor() colorEditor.__block = false } @@ -201,10 +214,10 @@ Row { } function isSolid() { - if (!loader.active) - return true + if (!loader.active) + return true - return popupDialog.loaderItem.isSolid() + return popupDialog.loaderItem.isSolid() } function isLinearGradient(){ @@ -221,6 +234,7 @@ Row { function open() { popupDialog.ensureLoader() + popupDialog.loaderItem.initEditor() popupDialog.show(preview) }