From 96e675cd2619fc4a87f4d8e7c3ac317e8e906560 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 31 Aug 2023 13:28:02 +0300 Subject: [PATCH] QmlDesigner: Fix 3D view grid color setting Grid color was not loaded correctly on scene creation, because there was a mismatch on how it was set. Normally, it was set as a color array, but on scene creation it was set as a single color. Changed it to be always set as a single color, as there is no reason to allow array of colors for grid. Fixes: QDS-10495 Change-Id: Idbe5d52a425eed7aed6beef9e3712b26519e5843 Reviewed-by: Mahmoud Badri Reviewed-by: Qt CI Patch Build Bot --- .../qmldesigner/components/edit3d/edit3dviewconfig.h | 7 ++++++- src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h b/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h index b077fed6a46..5c461cc7327 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h +++ b/src/plugins/qmldesigner/components/edit3d/edit3dviewconfig.h @@ -40,7 +40,12 @@ public: static void setColors(AbstractView *view, View3DActionType type, const QList &colorConfig) { - setVariant(view, type, QVariant::fromValue(colorConfig)); + QVariant param; + if (type == View3DActionType::SelectGridColor) + param = colorConfig.isEmpty() ? QColor() : colorConfig[0]; + else + param = QVariant::fromValue(colorConfig); + setVariant(view, type, param); } template diff --git a/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml b/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml index 220edc24476..8a4db279628 100644 --- a/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml +++ b/src/tools/qml2puppet/mockfiles/qt6/EditView3D.qml @@ -204,8 +204,8 @@ Item { } } - if ("selectGridColor" in viewStates && viewStates.selectGridColor.length === 1) - viewRoot.gridColor = viewStates.selectGridColor[0] + if ("selectGridColor" in viewStates) + viewRoot.gridColor = viewStates.selectGridColor } // If resetToDefault is true, tool states not specifically set to anything will be reset to