From 2c7b2ad6854a354aec5108ed4595369bca7f903a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 9 Aug 2021 15:13:11 +0300 Subject: [PATCH] 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 Reviewed-by: Samuel Ghinet Reviewed-by: Thomas Hartmann --- .../qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp | 2 +- .../instances/qt5informationnodeinstanceserver.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp index 39ca48b8e31..d5acb9f582c 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp @@ -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(); else theState = state; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index b48f37b07c1..426cd730ead 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -1471,8 +1471,11 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QListglobalStateId())) { - if (toolStates[helper->globalStateId()].contains(helper->rootSizeKey())) - m_editView3DData.rootItem->setSize(toolStates[helper->globalStateId()][helper->rootSizeKey()].value()); + if (toolStates[helper->globalStateId()].contains(helper->rootSizeKey())) { + QSize size = toolStates[helper->globalStateId()][helper->rootSizeKey()].value(); + 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(); }