summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-12-16 22:23:19 +0200
committerTim Jenssen <tim.jenssen@qt.io>2019-12-17 09:48:05 +0000
commite5d4224fe447e1af538ca8a7fa83e621a7e62883 (patch)
tree7e1dc77b37db3e169115100532f65626ba4b3d87
parent77126dc4b8bcd462daa2642aac1565521fbcbe5a (diff)
downloadqt-creator-e5d4224fe447e1af538ca8a7fa83e621a7e62883.tar.gz
Prevent the Edit View 3D restart upon closing
Also the 2D/3D action updates correctly according to Edit View 3D state. Task-number: QDS-1385 Change-Id: I95d0994e9c56df25a2988eb9d27994268dd1903d Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/commands.pri2
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp47
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h47
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp6
-rw-r--r--share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp6
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp5
-rw-r--r--src/plugins/qmldesigner/CMakeLists.txt1
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp3
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeinstanceview.h1
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp4
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp7
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.qbs2
-rw-r--r--src/tools/qml2puppet/CMakeLists.txt1
-rw-r--r--src/tools/qml2puppet/qml2puppet.qbs2
16 files changed, 137 insertions, 1 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
index 7985b25975..47ec4473ea 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri
+++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
@@ -30,6 +30,7 @@ HEADERS += $$PWD/changeselectioncommand.h
HEADERS += $$PWD/drop3dlibraryitemcommand.h
HEADERS += $$PWD/update3dviewstatecommand.h
HEADERS += $$PWD/enable3dviewcommand.h
+HEADERS += $$PWD/view3dclosedcommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/debugoutputcommand.cpp
@@ -61,3 +62,4 @@ SOURCES += $$PWD/changeselectioncommand.cpp
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
SOURCES += $$PWD/update3dviewstatecommand.cpp
SOURCES += $$PWD/enable3dviewcommand.cpp
+SOURCES += $$PWD/view3dclosedcommand.cpp
diff --git a/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp
new file mode 100644
index 0000000000..c7de7a99de
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "view3dclosedcommand.h"
+
+namespace QmlDesigner {
+
+View3DClosedCommand::View3DClosedCommand() = default;
+
+QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &/*command*/)
+{
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, View3DClosedCommand &/*command*/)
+{
+ return in;
+}
+
+QDebug operator<<(QDebug debug, const View3DClosedCommand &/*command*/)
+{
+ return debug.nospace() << "View3DClosedCommand()";
+}
+
+} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h b/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h
new file mode 100644
index 0000000000..132bb3c37b
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+class View3DClosedCommand
+{
+public:
+ View3DClosedCommand();
+};
+
+QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &command);
+QDataStream &operator>>(QDataStream &in, View3DClosedCommand &command);
+
+QDebug operator<<(QDebug debug, const View3DClosedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::View3DClosedCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
index d12cfe327f..01d9cd1842 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp
@@ -71,6 +71,7 @@
#include "puppetalivecommand.h"
#include "changeselectioncommand.h"
#include "drop3dlibraryitemcommand.h"
+#include "view3dclosedcommand.h"
namespace QmlDesigner {
@@ -261,6 +262,11 @@ void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemComman
writeCommand(QVariant::fromValue(command));
}
+void NodeInstanceClientProxy::view3DClosed(const View3DClosedCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
void NodeInstanceClientProxy::flush()
{
}
diff --git a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
index 5a742947d2..7c9724e1ff 100644
--- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
+++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h
@@ -60,6 +60,7 @@ class ChangeNodeSourceCommand;
class EndPuppetCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
+class View3DClosedCommand;
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
{
@@ -80,6 +81,7 @@ public:
void puppetAlive(const PuppetAliveCommand &command);
void selectionChanged(const ChangeSelectionCommand &command) override;
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
+ void view3DClosed(const View3DClosedCommand &command) override;
void flush() override;
void synchronizeWithClientProcess() override;
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h
index 10688cdd89..b188d7edfd 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h
@@ -42,6 +42,7 @@ class DebugOutputCommand;
class PuppetAliveCommand;
class ChangeSelectionCommand;
class Drop3DLibraryItemCommand;
+class View3DClosedCommand;
class NodeInstanceClientInterface
{
@@ -57,6 +58,7 @@ public:
virtual void debugOutput(const DebugOutputCommand &command) = 0;
virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
virtual void library3DItemDropped(const Drop3DLibraryItemCommand &command) = 0;
+ virtual void view3DClosed(const View3DClosedCommand &command) = 0;
virtual void flush() {}
virtual void synchronizeWithClientProcess() {}
diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
index bbd73e63ca..f606bfacf2 100644
--- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
+++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp
@@ -63,12 +63,13 @@
#include "endpuppetcommand.h"
#include "debugoutputcommand.h"
#include "puppetalivecommand.h"
+#include "view3dclosedcommand.h"
#include <enumeration.h>
namespace QmlDesigner {
-static bool isRegistered=false;
+static bool isRegistered = false;
NodeInstanceServerInterface::NodeInstanceServerInterface(QObject *parent) :
QObject(parent)
@@ -205,6 +206,9 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
+
+ qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
+ qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
}
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
index e65b1b4b2d..db38985d90 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
@@ -61,6 +61,7 @@
#include "removesharedmemorycommand.h"
#include "objectnodeinstance.h"
#include "drop3dlibraryitemcommand.h"
+#include "view3dclosedcommand.h"
#include "dummycontextobject.h"
#include "../editor3d/generalhelper.h"
@@ -97,6 +98,10 @@ bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event)
} break;
+ case QEvent::Close: {
+ nodeInstanceClient()->view3DClosed(View3DClosedCommand());
+ } break;
+
default:
break;
}
diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt
index 6d3bca379c..0a758c135f 100644
--- a/src/plugins/qmldesigner/CMakeLists.txt
+++ b/src/plugins/qmldesigner/CMakeLists.txt
@@ -142,6 +142,7 @@ extend_qtc_plugin(QmlDesigner
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
enable3dviewcommand.cpp enable3dviewcommand.h
+ view3dclosedcommand.cpp view3dclosedcommand.h
)
extend_qtc_plugin(QmlDesigner
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index ee7b3f18a9..baec381316 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -462,6 +462,9 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN
if (isInvisible)
newNode.deselectNode();
}
+ } else if (name == "3d-view") {
+ bool is3DEnabled = data.isNull() || data.toBool();
+ formEditorWidget()->option3DAction()->set3DEnabled(is3DEnabled);
}
}
diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
index f6b705acc3..c55dae2d87 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
@@ -138,6 +138,7 @@ public:
void selectionChanged(const ChangeSelectionCommand &command) override;
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
+ void view3DClosed(const View3DClosedCommand &command) override;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList) override;
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index d979e3dd32..07e3216f37 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -45,6 +45,7 @@
#include <changenodesourcecommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
+#include <view3dclosedcommand.h>
#include <informationchangedcommand.h>
#include <pixmapchangedcommand.h>
@@ -285,6 +286,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
+ static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand");
if (m_destructing)
return;
@@ -312,6 +314,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
} else if (command.userType() == drop3DLibraryItemCommandType) {
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
+ } else if (command.userType() == view3DClosedCommand) {
+ nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
} else if (command.userType() == puppetAliveCommandType) {
puppetAlive(puppetStreamType);
} else if (command.userType() == synchronizeCommandType) {
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 9528328754..a550a2e4b2 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -1454,6 +1454,13 @@ void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &comm
QmlVisualNode::createQmlVisualNode(this, itemLibraryEntry, {});
}
+void NodeInstanceView::view3DClosed(const View3DClosedCommand &command)
+{
+ Q_UNUSED(command)
+
+ rootModelNode().setAuxiliaryData("3d-view", false);
+}
+
void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> & /*lastSelectedNodeList*/)
{
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs
index 1ef8407d8e..67783c7c15 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.qbs
+++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs
@@ -175,6 +175,8 @@ Project {
"commands/update3dviewstatecommand.h",
"commands/enable3dviewcommand.cpp",
"commands/enable3dviewcommand.h",
+ "commands/view3dclosedcommand.cpp",
+ "commands/view3dclosedcommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",
diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt
index eb9abeda16..3912645283 100644
--- a/src/tools/qml2puppet/CMakeLists.txt
+++ b/src/tools/qml2puppet/CMakeLists.txt
@@ -48,6 +48,7 @@ extend_qtc_executable(qml2puppet
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
update3dviewstatecommand.cpp update3dviewstatecommand.h
enable3dviewcommand.cpp enable3dviewcommand.h
+ view3dclosedcommand.cpp view3dclosedcommand.h
valueschangedcommand.cpp
)
diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs
index fb73413038..645250c2d4 100644
--- a/src/tools/qml2puppet/qml2puppet.qbs
+++ b/src/tools/qml2puppet/qml2puppet.qbs
@@ -101,6 +101,8 @@ QtcTool {
"commands/update3dviewstatecommand.h",
"commands/enable3dviewcommand.cpp",
"commands/enable3dviewcommand.h",
+ "commands/view3dclosedcommand.cpp",
+ "commands/view3dclosedcommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",