QmlPuppet: Fix incorrect initial render size/scene for edit 3D

The scene id was stored as array of QChars instead of QString, which
caused issues restoring the correct scene at puppet reset.
The intitial incorrect render size was caused by not changing the
render window size in addition to root QML item size.

Fixes: QDS-4586
Change-Id: Id6b16d778a9d886e8fdc40eab1e549d13091f8f4
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2021-08-09 15:13:11 +03:00
parent ffe03c7870
commit 2c7b2ad685
2 changed files with 6 additions and 3 deletions

View File

@@ -328,7 +328,7 @@ void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool,
handlePendingToolStateUpdate();
QVariant theState;
// Convert JS arrays to QVariantLists for easier handling down the line
if (state.canConvert(QMetaType::QVariantList))
if (state.metaType().id() != QMetaType::QString && state.canConvert(QMetaType::QVariantList))
theState = state.value<QVariantList>();
else
theState = state;

View File

@@ -1471,8 +1471,11 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
++it;
}
if (toolStates.contains(helper->globalStateId())) {
if (toolStates[helper->globalStateId()].contains(helper->rootSizeKey()))
m_editView3DData.rootItem->setSize(toolStates[helper->globalStateId()][helper->rootSizeKey()].value<QSize>());
if (toolStates[helper->globalStateId()].contains(helper->rootSizeKey())) {
QSize size = toolStates[helper->globalStateId()][helper->rootSizeKey()].value<QSize>();
m_editView3DData.rootItem->setSize(size);
m_editView3DData.window->setGeometry(0, 0, size.width(), size.height());
}
if (toolStates[helper->globalStateId()].contains(helper->lastSceneIdKey()))
lastSceneId = toolStates[helper->globalStateId()][helper->lastSceneIdKey()].toString();
}