QmlDesigner: Remove the standalone view3D window implementation

Task-number: QDS-1692
Change-Id: I6c04aaee9ab6a119cfcc22ee2e19b808bb95ae0a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2020-03-02 15:51:28 +02:00
committed by Miikka Heikkinen
parent 5b8fe22337
commit fb843d3442
39 changed files with 19 additions and 773 deletions

View File

@@ -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

View File

@@ -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 <QDataStream>
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

View File

@@ -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 <QVector>
#include <QDataStream>
#include <QMimeData>
#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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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 <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)

View File

@@ -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<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>();
else if (command.userType() == changeSelectionCommandType)
return command.value<ChangeSelectionCommand>() == controlCommand.value<ChangeSelectionCommand>();
else if (command.userType() == drop3DLibraryItemCommandType)
return command.value<Drop3DLibraryItemCommand>() == controlCommand.value<Drop3DLibraryItemCommand>();
}
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()
{
}

View File

@@ -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;

View File

@@ -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() {}

View File

@@ -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 <enumeration.h>
@@ -116,9 +114,6 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<ChangeSelectionCommand>("ChangeSelectionCommand");
qRegisterMetaTypeStreamOperators<ChangeSelectionCommand>("ChangeSelectionCommand");
qRegisterMetaType<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
qRegisterMetaTypeStreamOperators<Drop3DLibraryItemCommand>("Drop3DLibraryItemCommand");
qRegisterMetaType<RemovePropertiesCommand>("RemovePropertiesCommand");
qRegisterMetaTypeStreamOperators<RemovePropertiesCommand>("RemovePropertiesCommand");
@@ -206,9 +201,6 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
qRegisterMetaType<PuppetToCreatorCommand>("PuppetToCreatorCommand");
qRegisterMetaTypeStreamOperators<PuppetToCreatorCommand>("PuppetToCreatorCommand");

View File

@@ -67,7 +67,6 @@
#include <tokencommand.h>
#include <removesharedmemorycommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
#include <inputeventcommand.h>
#include <view3dactioncommand.h>
@@ -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<InstancePropertyPair> &propertyList) const
{
QVector<PropertyValueContainer> valueVector;

View File

@@ -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<ServerNodeInstance> &instanceList) const;
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
Drop3DLibraryItemCommand createDrop3DLibraryItemCommand(const QByteArray &itemData, qint32 sceneRootId);
void addChangedProperty(const InstancePropertyPair &property);

View File

@@ -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<QDragMoveEvent *>(event))) {
event->ignore();
return true;
}
} break;
case QEvent::Drop: {
QDropEvent *dropEvent = static_cast<QDropEvent *>(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<QKeyEvent *>(event);
QPair<int, int> 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<QString, QString> 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<QQuick3DNode, 1>("MouseArea3D", 1, 0);
qmlRegisterType<QmlDesigner::Internal::MouseArea3D>("MouseArea3D", 1, 0, "MouseArea3D");
qmlRegisterType<QmlDesigner::Internal::CameraGeometry>("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<QQuickWindow *>(component.create());
m_editView3DRootItem = QQmlProperty::read(m_editWindow3D, "editViewRoot").value<QQuickItem *>();
//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<QQuickItem *>(component.create());
}
component.loadUrl(QUrl("qrc:/qtquickplugin/mockfiles/EditView3D.qml"));
m_editView3DRootItem = qobject_cast<QQuickItem *>(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<QQuickItem *>();
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)

View File

@@ -73,7 +73,6 @@ private slots:
protected:
void collectItemChangesAndSendChangeCommands() override;
bool eventFilter(QObject *obj, QEvent *event) override;
void sendChildrenChangedCommand(const QList<ServerNodeInstance> &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<QQuickView> m_editView3D;
QPointer<QQuickWindow> m_editWindow3D;
QQuickItem *m_editView3DRootItem = nullptr;
QQuickItem *m_editView3DContentItem = nullptr;
QSet<QObject *> m_view3Ds;

View File

@@ -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();
}

View File

@@ -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);
}
}

View File

@@ -166,8 +166,6 @@ signals:
void coreAboutToClose();
void contextAboutToChange(const QList<Core::IContext *> &context);
void contextChanged(const Core::Context &context);
void windowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
void windowActivationChanged(bool isActive, bool hasPopup);
public:
/* internal use */

View File

@@ -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<QWidget *>(*(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;

View File

@@ -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<std::function<bool()>> m_preCloseListeners;
Qt::WindowStates m_previousWindowStates = Qt::WindowNoState;
};
} // namespace Internal

View File

@@ -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

View File

@@ -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

View File

@@ -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<ModelNode> 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<ModelNode> 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;

View File

@@ -133,7 +133,6 @@ private:
void createFormEditorWidget();
void temporaryBlockView();
void resetNodeInstanceView();
void toggle3DViewEnabled(bool enabled);
QPointer<FormEditorWidget> m_formEditorWidget;
QPointer<FormEditorScene> m_scene;

View File

@@ -39,7 +39,6 @@
#include <formeditorscene.h>
#include <formeditorview.h>
#include <lineeditaction.h>
#include <option3daction.h>
#include <zoomaction.h>
#include <toolbox.h>
@@ -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();

View File

@@ -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<LineEditAction> m_rootWidthAction;
QPointer<LineEditAction> m_rootHeightAction;
QPointer<BackgroundAction> m_backgroundAction;
QPointer<Option3DAction> m_option3DAction;
QPointer<QAction> m_resetAction;
QPointer<DocumentWarningWidget> m_documentErrorWidget;
Core::IContext *m_context = nullptr;

View File

@@ -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 <QComboBox>
#include <QPainter>
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<int>::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

View File

@@ -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 <QWidgetAction>
#include <QPointer>
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<QComboBox> m_comboBox;
};
} // namespace QmlDesigner

View File

@@ -128,14 +128,10 @@ public:
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
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;
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;

View File

@@ -43,9 +43,7 @@
#include <completecomponentcommand.h>
#include <changenodesourcecommand.h>
#include <changeselectioncommand.h>
#include <drop3dlibraryitemcommand.h>
#include <puppettocreatorcommand.h>
#include <view3dclosedcommand.h>
#include <inputeventcommand.h>
#include <view3dactioncommand.h>
@@ -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<DebugOutputCommand>());
} else if (command.userType() == changeSelectionCommandType) {
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
} else if (command.userType() == drop3DLibraryItemCommandType) {
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
} else if (command.userType() == puppetToCreatorCommand) {
nodeInstanceClient()->handlePuppetToCreatorCommand(command.value<PuppetToCreatorCommand>());
} else if (command.userType() == view3DClosedCommand) {
nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
} else if (command.userType() == puppetAliveCommandType) {
puppetAlive(puppetStreamType);
} else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
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

View File

@@ -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<int, int> data = qvariant_cast<QPair<int, int>>(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<QVariantList>(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<ModelNode> &selectedNodeList,
const QList<ModelNode> & /*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));

View File

@@ -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();

View File

@@ -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();

View File

@@ -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<QByteArray, QVariant>

View File

@@ -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)

View File

@@ -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",

View File

@@ -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

View File

@@ -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",