From fb843d34424b08f9a9905f3f465c788dcf6765ed Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Mon, 2 Mar 2020 15:51:28 +0200 Subject: [PATCH] QmlDesigner: Remove the standalone view3D window implementation Task-number: QDS-1692 Change-Id: I6c04aaee9ab6a119cfcc22ee2e19b808bb95ae0a Reviewed-by: Miikka Heikkinen --- .../qml/qmlpuppet/commands/commands.pri | 4 - .../commands/drop3dlibraryitemcommand.cpp | 59 --------- .../commands/drop3dlibraryitemcommand.h | 61 --------- .../commands/puppettocreatorcommand.h | 2 +- .../commands/update3dviewstatecommand.cpp | 47 ------- .../commands/update3dviewstatecommand.h | 15 +-- .../commands/view3dclosedcommand.cpp | 47 ------- .../qmlpuppet/commands/view3dclosedcommand.h | 47 ------- .../instances/nodeinstanceclientproxy.cpp | 15 --- .../instances/nodeinstanceclientproxy.h | 4 - .../interfaces/nodeinstanceclientinterface.h | 4 - .../nodeinstanceserverinterface.cpp | 8 -- .../instances/nodeinstanceserver.cpp | 7 - .../qml2puppet/instances/nodeinstanceserver.h | 2 - .../qt5informationnodeinstanceserver.cpp | 123 ++---------------- .../qt5informationnodeinstanceserver.h | 3 - .../instances/qt5nodeinstanceclientproxy.cpp | 12 +- .../instances/qt5nodeinstanceserver.cpp | 14 +- src/plugins/coreplugin/icore.h | 2 - src/plugins/coreplugin/mainwindow.cpp | 25 ---- src/plugins/coreplugin/mainwindow.h | 2 - src/plugins/qmldesigner/CMakeLists.txt | 3 - .../components/formeditor/formeditor.pri | 2 - .../components/formeditor/formeditorview.cpp | 37 ------ .../components/formeditor/formeditorview.h | 1 - .../formeditor/formeditorwidget.cpp | 13 -- .../components/formeditor/formeditorwidget.h | 3 - .../components/formeditor/option3daction.cpp | 66 ---------- .../components/formeditor/option3daction.h | 52 -------- .../designercore/include/nodeinstanceview.h | 4 - .../instances/nodeinstanceserverproxy.cpp | 14 +- .../instances/nodeinstanceview.cpp | 63 +-------- .../designercore/instances/puppetcreator.cpp | 7 +- src/plugins/qmldesigner/designersettings.cpp | 1 - src/plugins/qmldesigner/designersettings.h | 1 - src/plugins/qmldesigner/qmldesignerplugin.cpp | 10 -- src/plugins/qmldesigner/qmldesignerplugin.qbs | 6 - src/tools/qml2puppet/CMakeLists.txt | 2 - src/tools/qml2puppet/qml2puppet.qbs | 4 - 39 files changed, 19 insertions(+), 773 deletions(-) delete mode 100644 share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp delete mode 100644 share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h delete mode 100644 share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp delete mode 100644 share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h delete mode 100644 src/plugins/qmldesigner/components/formeditor/option3daction.cpp delete mode 100644 src/plugins/qmldesigner/components/formeditor/option3daction.h diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri index deee4c34e1c..1bc858831ea 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri +++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri @@ -27,9 +27,7 @@ HEADERS += $$PWD/changeauxiliarycommand.h HEADERS += $$PWD/removesharedmemorycommand.h HEADERS += $$PWD/puppetalivecommand.h HEADERS += $$PWD/changeselectioncommand.h -HEADERS += $$PWD/drop3dlibraryitemcommand.h HEADERS += $$PWD/update3dviewstatecommand.h -HEADERS += $$PWD/view3dclosedcommand.h HEADERS += $$PWD/puppettocreatorcommand.h HEADERS += $$PWD/inputeventcommand.h HEADERS += $$PWD/view3dactioncommand.h @@ -61,9 +59,7 @@ SOURCES += $$PWD/changeauxiliarycommand.cpp SOURCES += $$PWD/removesharedmemorycommand.cpp SOURCES += $$PWD/puppetalivecommand.cpp SOURCES += $$PWD/changeselectioncommand.cpp -SOURCES += $$PWD/drop3dlibraryitemcommand.cpp SOURCES += $$PWD/update3dviewstatecommand.cpp -SOURCES += $$PWD/view3dclosedcommand.cpp SOURCES += $$PWD/puppettocreatorcommand.cpp SOURCES += $$PWD/inputeventcommand.cpp SOURCES += $$PWD/view3dactioncommand.cpp diff --git a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp deleted file mode 100644 index 6c851e3a432..00000000000 --- a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "drop3dlibraryitemcommand.h" - -#include - -namespace QmlDesigner { - -Drop3DLibraryItemCommand::Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId) - : m_itemData(itemData), - m_sceneRootId(sceneRootId) -{ -} - -QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command) -{ - out << command.itemData(); - out << command.sceneRootId(); - - return out; -} - -QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command) -{ - in >> command.m_itemData; - in >> command.m_sceneRootId; - - return in; -} - -bool operator==(const Drop3DLibraryItemCommand &first, const Drop3DLibraryItemCommand &second) -{ - return first.m_itemData == second.m_itemData && first.m_sceneRootId == second.m_sceneRootId; -} - -} // namespace QmlDesigner diff --git a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h b/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h deleted file mode 100644 index 4bc36e1ebdb..00000000000 --- a/share/qtcreator/qml/qmlpuppet/commands/drop3dlibraryitemcommand.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 -#include -#include - -#include "instancecontainer.h" - -namespace QmlDesigner { - -class Drop3DLibraryItemCommand -{ - friend QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command); - friend QDebug operator<<(QDebug debug, const Drop3DLibraryItemCommand &command); - friend bool operator==(const Drop3DLibraryItemCommand &first, - const Drop3DLibraryItemCommand &second); - -public: - explicit Drop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId); - Drop3DLibraryItemCommand() = default; - - QByteArray itemData() const { return m_itemData; } - qint32 sceneRootId() const { return m_sceneRootId; } - -private: - QByteArray m_itemData; - qint32 m_sceneRootId; -}; - -QDataStream &operator<<(QDataStream &out, const Drop3DLibraryItemCommand &command); -QDataStream &operator>>(QDataStream &in, Drop3DLibraryItemCommand &command); -bool operator==(const Drop3DLibraryItemCommand &first, const Drop3DLibraryItemCommand &second); - -} // namespace QmlDesigner - -Q_DECLARE_METATYPE(QmlDesigner::Drop3DLibraryItemCommand) diff --git a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h index 91c2877f4b3..a713656bde8 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h @@ -34,7 +34,7 @@ namespace QmlDesigner { class PuppetToCreatorCommand { public: - enum Type { KeyPressed, Edit3DToolState, Render3DView, ActiveSceneChanged, None }; + enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, None }; PuppetToCreatorCommand(Type type, const QVariant &data); PuppetToCreatorCommand() = default; diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp index 584e041c7ab..02fbdc0093d 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.cpp @@ -30,47 +30,12 @@ namespace QmlDesigner { -Update3dViewStateCommand::Update3dViewStateCommand(Qt::WindowStates previousStates, - Qt::WindowStates currentStates) - : m_previousStates(previousStates) - , m_currentStates(currentStates) - , m_type(Update3dViewStateCommand::StateChange) -{ -} - -Update3dViewStateCommand::Update3dViewStateCommand(bool active, bool hasPopup) - : m_active(active) - , m_hasPopup(hasPopup) - , m_type(Update3dViewStateCommand::ActiveChange) -{ -} - Update3dViewStateCommand::Update3dViewStateCommand(const QSize &size) : m_size(size) , m_type(Update3dViewStateCommand::SizeChange) { } -Qt::WindowStates Update3dViewStateCommand::previousStates() const -{ - return m_previousStates; -} - -Qt::WindowStates Update3dViewStateCommand::currentStates() const -{ - return m_currentStates; -} - -bool Update3dViewStateCommand::isActive() const -{ - return m_active; -} - -bool Update3dViewStateCommand::hasPopup() const -{ - return m_hasPopup; -} - QSize Update3dViewStateCommand::size() const { return m_size; @@ -83,10 +48,6 @@ Update3dViewStateCommand::Type Update3dViewStateCommand::type() const QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command) { - out << command.previousStates(); - out << command.currentStates(); - out << qint32(command.isActive()); - out << qint32(command.hasPopup()); out << qint32(command.type()); out << command.size(); @@ -95,16 +56,8 @@ QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &comman QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command) { - in >> command.m_previousStates; - in >> command.m_currentStates; - qint32 active; - qint32 hasPopup; qint32 type; - in >> active; - in >> hasPopup; in >> type; - command.m_active = active; - command.m_hasPopup = hasPopup; command.m_type = Update3dViewStateCommand::Type(type); in >> command.m_size; diff --git a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h index a38ca4bb543..ffc3fa66594 100644 --- a/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h +++ b/share/qtcreator/qml/qmlpuppet/commands/update3dviewstatecommand.h @@ -36,28 +36,15 @@ class Update3dViewStateCommand friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command); public: - enum Type { StateChange, ActiveChange, SizeChange, Empty }; + enum Type { SizeChange, Empty }; - explicit Update3dViewStateCommand(Qt::WindowStates previousStates, Qt::WindowStates currentStates); - explicit Update3dViewStateCommand(bool active, bool hasPopup); explicit Update3dViewStateCommand(const QSize &size); Update3dViewStateCommand() = default; - Qt::WindowStates previousStates() const; - Qt::WindowStates currentStates() const; - - bool isActive() const; - bool hasPopup() const; QSize size() const; - Type type() const; private: - Qt::WindowStates m_previousStates = Qt::WindowNoState; - Qt::WindowStates m_currentStates = Qt::WindowNoState; - - bool m_active = false; - bool m_hasPopup = false; QSize m_size; Type m_type = Empty; diff --git a/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp deleted file mode 100644 index c7de7a99dee..00000000000 --- a/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** 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 deleted file mode 100644 index 132bb3c37bd..00000000000 --- a/share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include - -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 e42c8bb3a2a..115bb5a90ab 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.cpp @@ -71,8 +71,6 @@ #include "debugoutputcommand.h" #include "puppetalivecommand.h" #include "changeselectioncommand.h" -#include "drop3dlibraryitemcommand.h" -#include "view3dclosedcommand.h" #include "puppettocreatorcommand.h" namespace QmlDesigner { @@ -152,7 +150,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand) static const int tokenCommandType = QMetaType::type("TokenCommand"); static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); - static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand"); if (command.userType() == controlCommand.userType()) { if (command.userType() == informationChangedCommandType) @@ -177,8 +174,6 @@ bool compareCommands(const QVariant &command, const QVariant &controlCommand) return command.value() == controlCommand.value(); else if (command.userType() == changeSelectionCommandType) return command.value() == controlCommand.value(); - else if (command.userType() == drop3DLibraryItemCommandType) - return command.value() == controlCommand.value(); } return false; @@ -266,21 +261,11 @@ void NodeInstanceClientProxy::selectionChanged(const ChangeSelectionCommand &com writeCommand(QVariant::fromValue(command)); } -void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemCommand &command) -{ - writeCommand(QVariant::fromValue(command)); -} - void NodeInstanceClientProxy::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) { 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 6cafd282af4..f66bb4362b6 100644 --- a/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h +++ b/share/qtcreator/qml/qmlpuppet/instances/nodeinstanceclientproxy.h @@ -58,9 +58,7 @@ class ChangeStateCommand; class ChangeNodeSourceCommand; class EndPuppetCommand; class ChangeSelectionCommand; -class Drop3DLibraryItemCommand; class PuppetToCreatorCommand; -class View3DClosedCommand; class InputEventCommand; class View3DActionCommand; @@ -82,9 +80,7 @@ public: void debugOutput(const DebugOutputCommand &command) override; void puppetAlive(const PuppetAliveCommand &command); void selectionChanged(const ChangeSelectionCommand &command) override; - void library3DItemDropped(const Drop3DLibraryItemCommand &command) override; void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &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 d289a1b2594..9498cfb1f76 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceclientinterface.h @@ -41,8 +41,6 @@ class RemoveSharedMemoryCommand; class DebugOutputCommand; class PuppetAliveCommand; class ChangeSelectionCommand; -class Drop3DLibraryItemCommand; -class View3DClosedCommand; class PuppetToCreatorCommand; class NodeInstanceClientInterface @@ -58,8 +56,6 @@ public: virtual void token(const TokenCommand &command) = 0; 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 handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) = 0; virtual void flush() {} diff --git a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp index b2703f7f320..307b7581997 100644 --- a/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp +++ b/share/qtcreator/qml/qmlpuppet/interfaces/nodeinstanceserverinterface.cpp @@ -47,7 +47,6 @@ #include "addimportcontainer.h" #include "changenodesourcecommand.h" #include "changeselectioncommand.h" -#include "drop3dlibraryitemcommand.h" #include "inputeventcommand.h" #include "view3dactioncommand.h" @@ -64,7 +63,6 @@ #include "endpuppetcommand.h" #include "debugoutputcommand.h" #include "puppetalivecommand.h" -#include "view3dclosedcommand.h" #include "puppettocreatorcommand.h" #include @@ -116,9 +114,6 @@ void NodeInstanceServerInterface::registerCommands() qRegisterMetaType("ChangeSelectionCommand"); qRegisterMetaTypeStreamOperators("ChangeSelectionCommand"); - qRegisterMetaType("Drop3DLibraryItemCommand"); - qRegisterMetaTypeStreamOperators("Drop3DLibraryItemCommand"); - qRegisterMetaType("RemovePropertiesCommand"); qRegisterMetaTypeStreamOperators("RemovePropertiesCommand"); @@ -206,9 +201,6 @@ void NodeInstanceServerInterface::registerCommands() qRegisterMetaType("PuppetAliveCommand"); qRegisterMetaTypeStreamOperators("PuppetAliveCommand"); - qRegisterMetaType("View3DClosedCommand"); - qRegisterMetaTypeStreamOperators("View3DClosedCommand"); - qRegisterMetaType("PuppetToCreatorCommand"); qRegisterMetaTypeStreamOperators("PuppetToCreatorCommand"); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp index 2b5f805f174..cfdc513c1b1 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp @@ -67,7 +67,6 @@ #include #include #include -#include #include #include @@ -1178,12 +1177,6 @@ ChangeSelectionCommand NodeInstanceServer::createChangeSelectionCommand(const QL return ChangeSelectionCommand(idVector); } -Drop3DLibraryItemCommand NodeInstanceServer::createDrop3DLibraryItemCommand(const QByteArray &itemData, - qint32 sceneRootId) -{ - return Drop3DLibraryItemCommand(itemData, sceneRootId); -} - ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVector &propertyList) const { QVector valueVector; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h index e2a5528bcf1..6b11e1b87f8 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.h @@ -70,7 +70,6 @@ class AddImportContainer; class MockupTypeContainer; class IdContainer; class ChangeSelectionCommand; -class Drop3DLibraryItemCommand; namespace Internal { class ChildrenChangeEventFilter; @@ -184,7 +183,6 @@ protected: ChildrenChangedCommand createChildrenChangedCommand(const ServerNodeInstance &parentInstance, const QList &instanceList) const; ComponentCompletedCommand createComponentCompletedCommand(const QList &instanceList); ChangeSelectionCommand createChangeSelectionCommand(const QList &instanceList); - Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId); void addChangedProperty(const InstancePropertyPair &property); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 296a95e7856..f6b5a47f451 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -59,9 +59,7 @@ #include "tokencommand.h" #include "removesharedmemorycommand.h" #include "objectnodeinstance.h" -#include "drop3dlibraryitemcommand.h" #include "puppettocreatorcommand.h" -#include "view3dclosedcommand.h" #include "inputeventcommand.h" #include "view3dactioncommand.h" @@ -100,80 +98,9 @@ static QVariant objectToVariant(QObject *object) return QVariant::fromValue(object); } -bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event) -{ - switch (event->type()) { - case QEvent::DragMove: { - if (!dropAcceptable(static_cast(event))) { - event->ignore(); - return true; - } - } break; - - case QEvent::Drop: { - QDropEvent *dropEvent = static_cast(event); - QByteArray data = dropEvent->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo")); - if (!data.isEmpty()) { - nodeInstanceClient()->library3DItemDropped(createDrop3DLibraryItemCommand( - data, active3DSceneInstance().instanceId())); - } - - } break; - - case QEvent::Close: { - nodeInstanceClient()->view3DClosed(View3DClosedCommand()); - } break; - - case QEvent::KeyPress: { - QKeyEvent *keyEvent = static_cast(event); - QPair data = {keyEvent->key(), int(keyEvent->modifiers())}; - nodeInstanceClient()->handlePuppetToCreatorCommand({PuppetToCreatorCommand::KeyPressed, - QVariant::fromValue(data)}); - } break; - - default: - break; - } - - return false; -} - -bool Qt5InformationNodeInstanceServer::dropAcceptable(QDragMoveEvent *event) const -{ - // Note: this method parses data out of the QDataStream. This should be in sync with how the - // data is written to the stream (check QDataStream overloaded operators << and >> in - // itemlibraryentry.cpp). If the write order changes, this logic may break. - QDataStream stream(event->mimeData()->data(QStringLiteral("application/vnd.bauhaus.itemlibraryinfo"))); - - QString name; - TypeName typeName; - int majorVersion; - int minorVersion; - QIcon typeIcon; - QString libraryEntryIconPath; - QString category; - QString requiredImport; - QHash hints; - - stream >> name; - stream >> typeName; - stream >> majorVersion; - stream >> minorVersion; - stream >> typeIcon; - stream >> libraryEntryIconPath; - stream >> category; - stream >> requiredImport; - stream >> hints; - - QString canBeDropped = hints.value("canBeDroppedInView3D"); - return canBeDropped == "true" || canBeDropped == "True"; -} - void Qt5InformationNodeInstanceServer::createEditView3D() { #ifdef QUICK3D_MODULE - static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW"); - qmlRegisterRevision("MouseArea3D", 1, 0); qmlRegisterType("MouseArea3D", 1, 0, "MouseArea3D"); qmlRegisterType("CameraGeometry", 1, 0, "CameraGeometry"); @@ -187,37 +114,19 @@ void Qt5InformationNodeInstanceServer::createEditView3D() engine()->rootContext()->setContextProperty("_generalHelper", helper); m_3dHelper = helper; + m_editView3D = new QQuickView(quickView()->engine(), quickView()); + m_editView3D->setFormat(quickView()->format()); + DesignerSupport::createOpenGLContext(m_editView3D.data()); QQmlComponent component(engine()); - if (showEditView) { - component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditWindow3D.qml")); - m_editWindow3D = qobject_cast(component.create()); - m_editView3DRootItem = QQmlProperty::read(m_editWindow3D, "editViewRoot").value(); - - //For macOS we have to use the 4.1 core profile - QSurfaceFormat surfaceFormat = m_editWindow3D->requestedFormat(); - surfaceFormat.setVersion(4, 1); - surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); - m_editWindow3D->setFormat(surfaceFormat); - } else { - m_editView3D = new QQuickView(quickView()->engine(), quickView()); - m_editView3D->setFormat(quickView()->format()); - DesignerSupport::createOpenGLContext(m_editView3D.data()); - component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml")); - m_editView3DRootItem = qobject_cast(component.create()); - } + component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml")); + m_editView3DRootItem = qobject_cast(component.create()); if (!m_editView3DRootItem) { qWarning() << "Could not create edit view 3D: " << component.errors(); return; } - if (!showEditView) { - DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem); - } else { - m_editView3DRootItem->installEventFilter(this); - QQmlProperty showButtonsProperty(m_editView3DRootItem, "showButtons", context()); - showButtonsProperty.write(QVariant(true)); - } + DesignerSupport::setRootItem(m_editView3D, m_editView3DRootItem); QObject::connect(m_editView3DRootItem, SIGNAL(selectionChanged(QVariant)), this, SLOT(handleSelectionChanged(QVariant))); @@ -233,8 +142,6 @@ void Qt5InformationNodeInstanceServer::createEditView3D() this, &Qt5InformationNodeInstanceServer::doRender3DEditView); helper->setParent(m_editView3DRootItem); - if (showEditView) - helper->setEdit3DWindow(m_editWindow3D); #endif } @@ -521,8 +428,7 @@ void Qt5InformationNodeInstanceServer::render3DEditView() // render the 3D edit view and send the result to creator process void Qt5InformationNodeInstanceServer::doRender3DEditView() { - static bool showEditView = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW"); - if (m_editView3DRootItem && !showEditView) { + if (m_editView3DRootItem) { if (!m_editView3DContentItem) { m_editView3DContentItem = QQmlProperty::read(m_editView3DRootItem, "contentItem").value(); if (m_editView3DContentItem) { @@ -1258,7 +1164,7 @@ void Qt5InformationNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxilia render3DEditView(); } -// update 3D view window state when the main app window state change +// update 3D view size when it changes in creator side void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewStateCommand &command) { #ifdef QUICK3D_MODULE @@ -1270,19 +1176,6 @@ void Qt5InformationNodeInstanceServer::update3DViewState(const Update3dViewState helper->storeToolState(helper->globalStateId(), "rootSize", QVariant(command.size()), 0); render3DEditView(); } - } else if (m_editWindow3D) { - if (command.type() == Update3dViewStateCommand::StateChange) { - if (command.previousStates() & Qt::WindowMinimized) // main window expanded from minimize state - m_editWindow3D->show(); - else if (command.currentStates() & Qt::WindowMinimized) // main window minimized - m_editWindow3D->hide(); - } else if (command.type() == Update3dViewStateCommand::ActiveChange) { - m_editWindow3D->setFlag(Qt::WindowStaysOnTopHint, command.isActive()); - - // main window has a popup open, lower the edit view 3D so that the pop up is visible - if (command.hasPopup()) - m_editWindow3D->lower(); - } } #else Q_UNUSED(command) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index 1e4d70577b0..5244064e9ef 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -73,7 +73,6 @@ private slots: protected: void collectItemChangesAndSendChangeCommands() override; - bool eventFilter(QObject *obj, QEvent *event) override; void sendChildrenChangedCommand(const QList &childList); void sendTokenBack(); bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const; @@ -101,7 +100,6 @@ private: void modifyVariantValue(const QVariant &node, const PropertyName &propertyName, ValuesModifiedCommand::TransactionOption option); - bool dropAcceptable(QDragMoveEvent *event) const; void updateView3DRect(QObject *view3D); void updateActiveSceneToEditView3D(); void removeNode3D(QObject *node); @@ -111,7 +109,6 @@ private: void doRender3DEditView(); QPointer m_editView3D; - QPointer m_editWindow3D; QQuickItem *m_editView3DRootItem = nullptr; QQuickItem *m_editView3DContentItem = nullptr; QSet m_view3Ds; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp index be54efd2c54..449e4ff188f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceclientproxy.cpp @@ -54,30 +54,20 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) : NodeInstanceClientProxy(parent) { prioritizeDown(); + DesignerSupport::activateDesignerWindowManager(); if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) { - DesignerSupport::activateDesignerWindowManager(); qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1"); setNodeInstanceServer(new Qt5TestNodeInstanceServer(this)); initializeCapturedStream(QCoreApplication::arguments().at(2)); readDataStream(); QCoreApplication::exit(); } else if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) { - DesignerSupport::activateDesignerWindowManager(); setNodeInstanceServer(new Qt5PreviewNodeInstanceServer(this)); initializeSocket(); } else if (QCoreApplication::arguments().at(2) == QLatin1String("editormode")) { - /* The editormode does not use the DesignerWindowManager, - * because we want to be able to show the 3D Edit View - * as a normal QQuickView. - * The DesignerWindowManager prevents any window from actually being shown. */ - if (!qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE") - || !qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) { - DesignerSupport::activateDesignerWindowManager(); - } setNodeInstanceServer(new Qt5InformationNodeInstanceServer(this)); initializeSocket(); } else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) { - DesignerSupport::activateDesignerWindowManager(); setNodeInstanceServer(new Qt5RenderNodeInstanceServer(this)); initializeSocket(); } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp index b503afb655c..822ffd4f1c7 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp @@ -71,21 +71,9 @@ void Qt5NodeInstanceServer::initializeView() DesignerSupport::createOpenGLContext(m_quickView.data()); - if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE") - && qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW") - && QCoreApplication::arguments().at(2) == "editormode") { - /* In '3d editormode' we do not use the DesignerWindowManager - * and since we do not show the QQuickView we have to manually create the OpenGL context */ - auto context = new QOpenGLContext(m_quickView); - context->setFormat(surfaceFormat); - context->create(); - if (!context->makeCurrent(m_quickView)) - qWarning("QOpenGLContext: makeCurrent() failed..."); - } - if (qEnvironmentVariableIsSet("QML_FILE_SELECTORS")) { QQmlFileSelector *fileSelector = new QQmlFileSelector(engine(), engine()); - QStringList customSelectors = QString::fromUtf8(qgetenv("QML_FILE_SELECTORS")).split(","); + QStringList customSelectors = QString::fromUtf8(qgetenv("QML_FILE_SELECTORS")).split(','); fileSelector->setExtraSelectors(customSelectors); } } diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index d6e426b3ed6..487a9715792 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -166,8 +166,6 @@ signals: void coreAboutToClose(); void contextAboutToChange(const QList &context); void contextChanged(const Core::Context &context); - void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); - void windowActivationChanged(bool isActive, bool hasPopup); public: /* internal use */ diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f3a948f330f..4af57a6fd91 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -197,31 +197,6 @@ MainWindow::MainWindow() this, &MainWindow::openDroppedFiles); } -// Edit View 3D needs to know when the main window's state or activation change -void MainWindow::changeEvent(QEvent *event) -{ - if (event->type() == QEvent::WindowStateChange) { - emit m_coreImpl->windowStateChanged(m_previousWindowStates, windowState()); - m_previousWindowStates = windowState(); - } else if (event->type() == QEvent::ActivationChange) { - // check the last 3 children for a possible active window - auto rIter = children().rbegin(); - bool hasPopup = false; - for (int i = 0; i < 3; ++i) { - if (rIter < children().rend()) { - auto child = qobject_cast(*(rIter++)); - if (child && child->isActiveWindow()) { - hasPopup = true; - break; - } - } else { - break; - } - } - emit m_coreImpl->windowActivationChanged(isActiveWindow(), hasPopup); - } -} - NavigationWidget *MainWindow::navigationWidget(Side side) const { return side == Side::Left ? m_leftNavigationWidget : m_rightNavigationWidget; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 865a6e8aaa7..0d7b533086a 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -116,7 +116,6 @@ public slots: protected: void closeEvent(QCloseEvent *event) override; - void changeEvent(QEvent *event) override; private: void openFile(); @@ -195,7 +194,6 @@ private: QToolButton *m_toggleRightSideBarButton = nullptr; QColor m_overrideColor; QList> m_preCloseListeners; - Qt::WindowStates m_previousWindowStates = Qt::WindowNoState; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 82c26c43adc..85e0c67ec9e 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -139,9 +139,7 @@ extend_qtc_plugin(QmlDesigner tokencommand.cpp tokencommand.h valueschangedcommand.cpp valueschangedcommand.h changeselectioncommand.cpp changeselectioncommand.h - drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h update3dviewstatecommand.cpp update3dviewstatecommand.h - view3dclosedcommand.cpp view3dclosedcommand.h puppettocreatorcommand.cpp puppettocreatorcommand.h inputeventcommand.cpp inputeventcommand.h view3dactioncommand.cpp view3dactioncommand.h @@ -248,7 +246,6 @@ extend_qtc_plugin(QmlDesigner snapper.cpp snapper.h snappinglinecreator.cpp snappinglinecreator.h toolbox.cpp toolbox.h - option3daction.cpp option3daction.h ) extend_qtc_plugin(QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/formeditor.pri b/src/plugins/qmldesigner/components/formeditor/formeditor.pri index dba3a8a6b74..3464ba3afe4 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditor.pri +++ b/src/plugins/qmldesigner/components/formeditor/formeditor.pri @@ -36,7 +36,6 @@ SOURCES += formeditoritem.cpp \ contentnoteditableindicator.cpp \ backgroundaction.cpp \ formeditortoolbutton.cpp \ - option3daction.cpp \ formeditorannotationicon.cpp HEADERS += formeditorscene.h \ @@ -76,7 +75,6 @@ HEADERS += formeditorscene.h \ contentnoteditableindicator.h \ backgroundaction.h \ formeditortoolbutton.h \ - option3daction.h \ formeditorannotationicon.h RESOURCES += formeditor.qrc diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index a9da5b22f49..c37ff56cc04 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -27,7 +27,6 @@ #include "nodeinstanceview.h" #include "selectiontool.h" #include "movetool.h" -#include "option3daction.h" #include "resizetool.h" #include "dragtool.h" #include "formeditorwidget.h" @@ -87,12 +86,6 @@ void FormEditorView::modelAttached(Model *model) setupFormEditorItemTree(rootModelNode()); m_formEditorWidget->updateActions(); - m_formEditorWidget->option3DAction()->set3DEnabled(rootModelNode().hasAuxiliaryData("3d-view")); - - // disable option3DAction if no View3D(s) exists in attached model - const QList views3D = rootModelNode().subModelNodesOfType("QtQuick3D.View3D"); - if (views3D.size() == 0) - m_formEditorWidget->option3DAction()->setEnabled(false); if (!rewriterView()->errors().isEmpty()) m_formEditorWidget->showErrorMessageBox(rewriterView()->errors()); @@ -213,7 +206,6 @@ void FormEditorView::createFormEditorWidget() }); connect(m_formEditorWidget->showBoundingRectAction(), &QAction::toggled, scene(), &FormEditorScene::setShowBoundingRects); - connect(m_formEditorWidget->option3DAction(), &Option3DAction::enabledChanged, this, &FormEditorView::toggle3DViewEnabled); connect(m_formEditorWidget->resetAction(), &QAction::triggered, this, &FormEditorView::resetNodeInstanceView); } @@ -236,9 +228,6 @@ void FormEditorView::nodeCreated(const ModelNode &node) setupFormEditorItemTree(QmlItemNode(node)); else if (QmlVisualNode::isFlowTransition(node)) setupFormEditorItemTree(QmlItemNode(node)); - - if (node.isSubclassOf("QtQuick3D.Node")) - m_formEditorWidget->option3DAction()->setEnabled(true); } void FormEditorView::modelAboutToBeDetached(Model *model) @@ -270,13 +259,6 @@ void FormEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) const QmlItemNode qmlItemNode(removedNode); removeNodeFromScene(qmlItemNode); - - const QList nodes3D = rootModelNode().subModelNodesOfType("QtQuick3D.Node"); - - // if no more 3D Nodes exist after the node removal, disable option3DAction - bool hasView3D = nodes3D.size() > 1 || (nodes3D.size() == 1 && nodes3D[0] != removedNode); - if (!hasView3D) - m_formEditorWidget->option3DAction()->setEnabled(false); } void FormEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) @@ -534,9 +516,6 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN if (isInvisible) newNode.deselectNode(); } - } else if (name == "3d-view") { - DesignerSettings::setValue(DesignerSettingsKey::VIEW_3D_ACTIVE, data); - m_formEditorWidget->option3DAction()->set3DEnabled(data.toBool()); } else if (item.isFlowTransition() || item.isFlowItem() || item.isFlowActionArea()) { FormEditorItem *editorItem = m_scene->itemForQmlItemNode(item); if (editorItem) @@ -671,22 +650,6 @@ void FormEditorView::exportAsImage() m_formEditorWidget->exportAsImage(m_scene->rootFormEditorItem()->boundingRect()); } -void FormEditorView::toggle3DViewEnabled(bool enabled) -{ - QTC_ASSERT(model(), return); - QTC_ASSERT(rootModelNode().isValid(), return); - - if (enabled == rootModelNode().hasAuxiliaryData("3d-view")) - return; - - if (enabled) - rootModelNode().setAuxiliaryData("3d-view", true); - else - rootModelNode().removeAuxiliaryData("3d-view"); - - resetNodeInstanceView(); -} - QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode) { QmlObjectNode qmlObjectNode = firstQmlObjectNode; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.h b/src/plugins/qmldesigner/components/formeditor/formeditorview.h index 1558563337d..85cc5821ee4 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.h @@ -133,7 +133,6 @@ private: void createFormEditorWidget(); void temporaryBlockView(); void resetNodeInstanceView(); - void toggle3DViewEnabled(bool enabled); QPointer m_formEditorWidget; QPointer m_scene; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index 24177ccc6c9..f13de043258 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -146,13 +145,6 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : upperActions.append(m_backgroundAction.data()); m_toolBox->addRightSideAction(m_backgroundAction.data()); - m_option3DAction = new Option3DAction(m_toolActionGroup.data()); - if (qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_SHOW_EDIT_WINDOW")) { - addAction(m_option3DAction.data()); - upperActions.append(m_option3DAction.data()); - m_toolBox->addRightSideAction(m_option3DAction.data()); - } - m_zoomAction = new ZoomAction(m_toolActionGroup.data()); connect(m_zoomAction.data(), &ZoomAction::zoomLevelChanged, this, &FormEditorWidget::setZoomLevel); @@ -298,11 +290,6 @@ ZoomAction *FormEditorWidget::zoomAction() const return m_zoomAction.data(); } -Option3DAction *FormEditorWidget::option3DAction() const -{ - return m_option3DAction.data(); -} - QAction *FormEditorWidget::resetAction() const { return m_resetAction.data(); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h index f8cd0cd1a8d..eb01611682f 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h @@ -40,7 +40,6 @@ namespace QmlDesigner { class ZoomAction; class LineEditAction; class BackgroundAction; -class Option3DAction; class FormEditorView; class FormEditorScene; class FormEditorGraphicsView; @@ -54,7 +53,6 @@ public: FormEditorWidget(FormEditorView *view); ZoomAction *zoomAction() const; - Option3DAction *option3DAction() const; QAction *showBoundingRectAction() const; QAction *snappingAction() const; QAction *snappingAndAnchoringAction() const; @@ -113,7 +111,6 @@ private: QPointer m_rootWidthAction; QPointer m_rootHeightAction; QPointer m_backgroundAction; - QPointer m_option3DAction; QPointer m_resetAction; QPointer m_documentErrorWidget; Core::IContext *m_context = nullptr; diff --git a/src/plugins/qmldesigner/components/formeditor/option3daction.cpp b/src/plugins/qmldesigner/components/formeditor/option3daction.cpp deleted file mode 100644 index e7c88158d8f..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/option3daction.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "option3daction.h" - -#include -#include - -namespace QmlDesigner { - -Option3DAction::Option3DAction(QObject *parent) : - QWidgetAction(parent) -{ -} - -void Option3DAction::set3DEnabled(bool enabled) -{ - if (m_comboBox) { - m_comboBox->blockSignals(true); - m_comboBox->setCurrentIndex(enabled ? 1 : 0); - m_comboBox->blockSignals(false); - } -} - -QWidget *Option3DAction::createWidget(QWidget *parent) -{ - m_comboBox = new QComboBox(parent); - m_comboBox->setFixedWidth(82); - - m_comboBox->addItem(tr("2D")); - m_comboBox->addItem(tr("2D/3D")); - - m_comboBox->setCurrentIndex(0); - connect(m_comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, [this]() { - emit enabledChanged(m_comboBox->currentIndex() != 0); - }); - - m_comboBox->setProperty("hideborder", true); - m_comboBox->setToolTip(tr("Enable/Disable 3D edit mode.")); - - return m_comboBox; -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/option3daction.h b/src/plugins/qmldesigner/components/formeditor/option3daction.h deleted file mode 100644 index ab01c1b364e..00000000000 --- a/src/plugins/qmldesigner/components/formeditor/option3daction.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 -#include - -QT_FORWARD_DECLARE_CLASS(QComboBox) - -namespace QmlDesigner { - -class Option3DAction : public QWidgetAction -{ - Q_OBJECT - -public: - explicit Option3DAction(QObject *parent); - void set3DEnabled(bool enabled); - -signals: - void enabledChanged(bool enabled); - -protected: - QWidget *createWidget(QWidget *parent) override; - -private: - QPointer m_comboBox; -}; - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index 6087997332c..c7bd9d3682c 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -128,14 +128,10 @@ public: void sendToken(const QString &token, int number, const QVector &nodeVector); void selectionChanged(const ChangeSelectionCommand &command) override; - void library3DItemDropped(const Drop3DLibraryItemCommand &command) override; - void view3DClosed(const View3DClosedCommand &command) override; void selectedNodesChanged(const QList &selectedNodeList, const QList &lastSelectedNodeList) override; - void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates); - void mainWindowActiveChanged(bool active, bool hasPopup); void sendInputEvent(QInputEvent *e) const; void view3DAction(const View3DActionCommand &command); void edit3DViewResized(const QSize &size) const; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index 480f1e4472a..82b1e533410 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -43,9 +43,7 @@ #include #include #include -#include #include -#include #include #include @@ -286,9 +284,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand"); static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand"); static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand"); - static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand"); static const int puppetToCreatorCommand = QMetaType::type("PuppetToCreatorCommand"); - static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand"); if (m_destructing) return; @@ -314,20 +310,18 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr nodeInstanceClient()->debugOutput(command.value()); } else if (command.userType() == changeSelectionCommandType) { nodeInstanceClient()->selectionChanged(command.value()); - } else if (command.userType() == drop3DLibraryItemCommandType) { - nodeInstanceClient()->library3DItemDropped(command.value()); } else if (command.userType() == puppetToCreatorCommand) { nodeInstanceClient()->handlePuppetToCreatorCommand(command.value()); - } else if (command.userType() == view3DClosedCommand) { - nodeInstanceClient()->view3DClosed(command.value()); } else if (command.userType() == puppetAliveCommandType) { puppetAlive(puppetStreamType); } else if (command.userType() == synchronizeCommandType) { SynchronizeCommand synchronizeCommand = command.value(); m_synchronizeId = synchronizeCommand.synchronizeId(); - } else + } else { Q_ASSERT(false); - qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType(); + } + + qCInfo(instanceViewBenchmark) << "dispatching command" << "done" << command.userType(); } NodeInstanceClientInterface *NodeInstanceServerProxy::nodeInstanceClient() const diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 66572534261..d68a2ce7e8a 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -53,7 +53,6 @@ #include "changebindingscommand.h" #include "changeidscommand.h" #include "changeselectioncommand.h" -#include "drop3dlibraryitemcommand.h" #include "changenodesourcecommand.h" #include "removeinstancescommand.h" #include "removepropertiescommand.h" @@ -1447,23 +1446,10 @@ void NodeInstanceView::selectionChanged(const ChangeSelectionCommand &command) selectModelNode(modelNodeForInternalId(instanceId)); } } -void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &command) -{ - QDataStream stream(command.itemData()); - ItemLibraryEntry itemLibraryEntry; - stream >> itemLibraryEntry; - QmlVisualNode::createQml3DNode(this, itemLibraryEntry, command.sceneRootId(), {}); -} void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) { - if (command.type() == PuppetToCreatorCommand::KeyPressed) { - QPair data = qvariant_cast>(command.data()); - int key = data.first; - Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(data.second); - - handlePuppetKeyPress(key, modifiers); - } else if (command.type() == PuppetToCreatorCommand::Edit3DToolState) { + if (command.type() == PuppetToCreatorCommand::Edit3DToolState) { if (!m_nodeInstanceServer.isNull()) { auto data = qvariant_cast(command.data()); if (data.size() == 3) { @@ -1481,59 +1467,12 @@ void NodeInstanceView::handlePuppetToCreatorCommand(const PuppetToCreatorCommand } } -// puppet to creator command handlers -void NodeInstanceView::handlePuppetKeyPress(int key, Qt::KeyboardModifiers modifiers) -{ - // TODO: optimal way to handle key events is to just pass them on. This is done - // using the code below but it is so far not working, if someone could get it to work then - // it should be utilized and the rest of the method deleted -// QCoreApplication::postEvent([receiver], new QKeyEvent(QEvent::KeyPress, key, modifiers)); - -#ifndef QMLDESIGNER_TEST - // handle common keyboard actions coming from puppet - if (Core::ActionManager::command(Core::Constants::UNDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - QmlDesignerPlugin::instance()->currentDesignDocument()->undo(); - else if (Core::ActionManager::command(Core::Constants::REDO)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - QmlDesignerPlugin::instance()->currentDesignDocument()->redo(); - else if (Core::ActionManager::command(Core::Constants::SAVE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - Core::EditorManager::saveDocument(); - else if (Core::ActionManager::command(Core::Constants::SAVEAS)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - Core::EditorManager::saveDocumentAs(); - else if (Core::ActionManager::command(Core::Constants::SAVEALL)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - Core::DocumentManager::saveAllModifiedDocuments(); - else if (Core::ActionManager::command(QmlDesigner::Constants::C_DELETE)->keySequence().matches(key + modifiers) == QKeySequence::ExactMatch) - QmlDesignerPlugin::instance()->currentDesignDocument()->deleteSelected(); -#else - Q_UNUSED(key); - Q_UNUSED(modifiers); -#endif -} - -void NodeInstanceView::view3DClosed(const View3DClosedCommand &command) -{ - Q_UNUSED(command) - - rootModelNode().removeAuxiliaryData("3d-view"); -} - void NodeInstanceView::selectedNodesChanged(const QList &selectedNodeList, const QList & /*lastSelectedNodeList*/) { nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList)); } -void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates) -{ - if (nodeInstanceServer()) - nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates)); -} - -void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup) -{ - if (nodeInstanceServer()) - nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup)); -} - void NodeInstanceView::sendInputEvent(QInputEvent *e) const { nodeInstanceServer()->inputEvent(InputEventCommand(e)); diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 80672b17a9c..ba5b9a9f04d 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -476,13 +476,10 @@ QProcessEnvironment PuppetCreator::processEnvironment() const auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView(); view->emitCustomNotification("PuppetStatus", {}, {QVariant(m_qrcMapping)}); - // set env var and aux data if 3d-view is enabled + // set env var if QtQuick3D import exists QmlDesigner::Import import = QmlDesigner::Import::createLibraryImport("QtQuick3D", "1.0"); - if (m_model->hasImport(import, true, true) - && DesignerSettings::getValue(DesignerSettingsKey::VIEW_3D_ACTIVE).toBool()) { - view->rootModelNode().setAuxiliaryData("3d-view", true); + if (m_model->hasImport(import, true, true)) environment.set("QMLDESIGNER_QUICK3D_MODE", "true"); - } #endif QStringList importPaths = m_model->importPaths(); diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 328d07bb727..4944cef9db2 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -84,7 +84,6 @@ void DesignerSettings::fromSettings(QSettings *settings) ); restoreValue(settings, DesignerSettingsKey::SIMPLE_COLOR_PALETTE_CONTENT, QStringList()); restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true); - restoreValue(settings, DesignerSettingsKey::VIEW_3D_ACTIVE, false); settings->endGroup(); settings->endGroup(); diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index f3a2d42430b..ec4dc1f7e58 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -67,7 +67,6 @@ const char STANDALONE_MODE[] = "StandAloneMode"; const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView"; const char SIMPLE_COLOR_PALETTE_CONTENT[] = "SimpleColorPaletteContent"; const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode"; -const char VIEW_3D_ACTIVE[] = "View3DActive"; } class DesignerSettings : public QHash diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index c1249f3dbdc..1a2f3c8c273 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -253,16 +253,6 @@ void QmlDesignerPlugin::extensionsInitialized() connect(Core::ICore::instance(), &Core::ICore::coreAboutToOpen, this, [this] { integrateIntoQtCreator(&d->mainWidget); }); - - connect(Core::ICore::instance(), &Core::ICore::windowStateChanged, this, - [this] (Qt::WindowStates previousStates, Qt::WindowStates currentStates) { - d->viewManager.nodeInstanceView()->mainWindowStateChanged(previousStates, currentStates); - }); - - connect(Core::ICore::instance(), &Core::ICore::windowActivationChanged, this, - [this] (bool isActive, bool hasPopup) { - d->viewManager.nodeInstanceView()->mainWindowActiveChanged(isActive, hasPopup); - }); } static QStringList allUiQmlFilesforCurrentProject(const Utils::FilePath &fileName) diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 4bad2b32bed..3c434788cd9 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -173,12 +173,8 @@ Project { "commands/valueschangedcommand.h", "commands/changeselectioncommand.cpp", "commands/changeselectioncommand.h", - "commands/drop3dlibraryitemcommand.cpp", - "commands/drop3dlibraryitemcommand.h", "commands/update3dviewstatecommand.cpp", "commands/update3dviewstatecommand.h", - "commands/view3dclosedcommand.cpp", - "commands/view3dclosedcommand.h", "commands/puppettocreatorcommand.cpp", "commands/puppettocreatorcommand.h", "commands/inputeventcommand.cpp", @@ -534,8 +530,6 @@ Project { "formeditor/toolbox.h", "formeditor/formeditortoolbutton.cpp", "formeditor/formeditortoolbutton.h", - "formeditor/option3daction.cpp", - "formeditor/option3daction.h", "importmanager/importlabel.cpp", "importmanager/importlabel.h", "importmanager/importmanagercombobox.cpp", diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index 8c7a18cf76c..50d457f4f38 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -45,9 +45,7 @@ extend_qtc_executable(qml2puppet synchronizecommand.cpp synchronizecommand.h tokencommand.cpp tokencommand.h changeselectioncommand.cpp changeselectioncommand.h - drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h update3dviewstatecommand.cpp update3dviewstatecommand.h - view3dclosedcommand.cpp view3dclosedcommand.h puppettocreatorcommand.cpp puppettocreatorcommand.h inputeventcommand.cpp inputeventcommand.h view3dactioncommand.cpp view3dactioncommand.h diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index bf494c8a7bd..c5c49670b4a 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -95,12 +95,8 @@ QtcTool { "commands/valueschangedcommand.h", "commands/changeselectioncommand.cpp", "commands/changeselectioncommand.h", - "commands/drop3dlibraryitemcommand.cpp", - "commands/drop3dlibraryitemcommand.h", "commands/update3dviewstatecommand.cpp", "commands/update3dviewstatecommand.h", - "commands/view3dclosedcommand.cpp", - "commands/view3dclosedcommand.h", "commands/puppettocreatorcommand.cpp", "commands/puppettocreatorcommand.h", "commands/inputeventcommand.cpp",