QmlDesigner: Handle active scene id change properly on edit 3D view

The scene id shown on the corner of edit 3D view is updated and
toolstates are also stored under the new id.

Change-Id: Ib3ac2f2bb829a5d908e22932c313c76bd4143592
Fixes: QDS-2277
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-06-26 17:49:28 +03:00
parent ba942583b8
commit 85bcae2c38
2 changed files with 23 additions and 1 deletions

View File

@@ -141,6 +141,14 @@ Item {
_generalHelper.enableItemUpdate(editView, (scene && scene === activeScene)); _generalHelper.enableItemUpdate(editView, (scene && scene === activeScene));
} }
function handleActiveSceneIdChange(newId)
{
if (sceneId !== newId) {
sceneId = newId;
storeCurrentToolStates();
}
}
function fitToView() function fitToView()
{ {
if (editView) { if (editView) {

View File

@@ -1253,12 +1253,26 @@ void Qt5InformationNodeInstanceServer::changeIds(const ChangeIdsCommand &command
{ {
Qt5NodeInstanceServer::changeIds(command); Qt5NodeInstanceServer::changeIds(command);
if (m_active3DSceneUpdatePending) { #ifdef QUICK3D_MODULE
ServerNodeInstance sceneInstance = active3DSceneInstance(); ServerNodeInstance sceneInstance = active3DSceneInstance();
if (m_active3DSceneUpdatePending) {
const QString sceneId = sceneInstance.id(); const QString sceneId = sceneInstance.id();
if (!sceneId.isEmpty()) if (!sceneId.isEmpty())
updateActiveSceneToEditView3D(); updateActiveSceneToEditView3D();
} else {
qint32 sceneInstanceId = sceneInstance.instanceId();
const QVector<IdContainer> ids = command.ids();
for (const auto &id : ids) {
if (sceneInstanceId == id.instanceId()) {
QMetaObject::invokeMethod(m_editView3DRootItem, "handleActiveSceneIdChange",
Qt::QueuedConnection,
Q_ARG(QVariant, QVariant(sceneInstance.id())));
render3DEditView();
break;
} }
}
}
#endif
} }
void Qt5InformationNodeInstanceServer::changeState(const ChangeStateCommand &command) void Qt5InformationNodeInstanceServer::changeState(const ChangeStateCommand &command)