diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-12-16 22:23:19 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2019-12-17 09:48:05 +0000 |
commit | e5d4224fe447e1af538ca8a7fa83e621a7e62883 (patch) | |
tree | 7e1dc77b37db3e169115100532f65626ba4b3d87 /share | |
parent | 77126dc4b8bcd462daa2642aac1565521fbcbe5a (diff) |
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>
Diffstat (limited to 'share')
8 files changed, 116 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; } |