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 <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-08-31 13:28:02 +03:00
parent 9324f4bd4b
commit 96e675cd26
2 changed files with 8 additions and 3 deletions

View File

@@ -40,7 +40,12 @@ public:
static void setColors(AbstractView *view, View3DActionType type, const QList<QColor> &colorConfig) static void setColors(AbstractView *view, View3DActionType type, const QList<QColor> &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 <typename T> template <typename T>

View File

@@ -204,8 +204,8 @@ Item {
} }
} }
if ("selectGridColor" in viewStates && viewStates.selectGridColor.length === 1) if ("selectGridColor" in viewStates)
viewRoot.gridColor = viewStates.selectGridColor[0] viewRoot.gridColor = viewStates.selectGridColor
} }
// If resetToDefault is true, tool states not specifically set to anything will be reset to // If resetToDefault is true, tool states not specifically set to anything will be reset to