forked from qt-creator/qt-creator
Prevent the Edit View 3D restart upon closing
Also the 2D/3D action updates correctly according to Edit View 3D state. Task-number: QDS-1385 Change-Id: I95d0994e9c56df25a2988eb9d27994268dd1903d Reviewed-by: Henning Gründl <henning.gruendl@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
77126dc4b8
commit
e5d4224fe4
@@ -30,6 +30,7 @@ HEADERS += $$PWD/changeselectioncommand.h
|
||||
HEADERS += $$PWD/drop3dlibraryitemcommand.h
|
||||
HEADERS += $$PWD/update3dviewstatecommand.h
|
||||
HEADERS += $$PWD/enable3dviewcommand.h
|
||||
HEADERS += $$PWD/view3dclosedcommand.h
|
||||
|
||||
SOURCES += $$PWD/synchronizecommand.cpp
|
||||
SOURCES += $$PWD/debugoutputcommand.cpp
|
||||
@@ -61,3 +62,4 @@ SOURCES += $$PWD/changeselectioncommand.cpp
|
||||
SOURCES += $$PWD/drop3dlibraryitemcommand.cpp
|
||||
SOURCES += $$PWD/update3dviewstatecommand.cpp
|
||||
SOURCES += $$PWD/enable3dviewcommand.cpp
|
||||
SOURCES += $$PWD/view3dclosedcommand.cpp
|
||||
|
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "view3dclosedcommand.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
View3DClosedCommand::View3DClosedCommand() = default;
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &/*command*/)
|
||||
{
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, View3DClosedCommand &/*command*/)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const View3DClosedCommand &/*command*/)
|
||||
{
|
||||
return debug.nospace() << "View3DClosedCommand()";
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
47
share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h
Normal file
47
share/qtcreator/qml/qmlpuppet/commands/view3dclosedcommand.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qmetatype.h>
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class View3DClosedCommand
|
||||
{
|
||||
public:
|
||||
View3DClosedCommand();
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const View3DClosedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, View3DClosedCommand &command);
|
||||
|
||||
QDebug operator<<(QDebug debug, const View3DClosedCommand &command);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::View3DClosedCommand)
|
@@ -71,6 +71,7 @@
|
||||
#include "puppetalivecommand.h"
|
||||
#include "changeselectioncommand.h"
|
||||
#include "drop3dlibraryitemcommand.h"
|
||||
#include "view3dclosedcommand.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
@@ -261,6 +262,11 @@ void NodeInstanceClientProxy::library3DItemDropped(const Drop3DLibraryItemComman
|
||||
writeCommand(QVariant::fromValue(command));
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::view3DClosed(const View3DClosedCommand &command)
|
||||
{
|
||||
writeCommand(QVariant::fromValue(command));
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::flush()
|
||||
{
|
||||
}
|
||||
|
@@ -60,6 +60,7 @@ class ChangeNodeSourceCommand;
|
||||
class EndPuppetCommand;
|
||||
class ChangeSelectionCommand;
|
||||
class Drop3DLibraryItemCommand;
|
||||
class View3DClosedCommand;
|
||||
|
||||
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
|
||||
{
|
||||
@@ -80,6 +81,7 @@ public:
|
||||
void puppetAlive(const PuppetAliveCommand &command);
|
||||
void selectionChanged(const ChangeSelectionCommand &command) override;
|
||||
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
|
||||
void view3DClosed(const View3DClosedCommand &command) override;
|
||||
|
||||
void flush() override;
|
||||
void synchronizeWithClientProcess() override;
|
||||
|
@@ -42,6 +42,7 @@ class DebugOutputCommand;
|
||||
class PuppetAliveCommand;
|
||||
class ChangeSelectionCommand;
|
||||
class Drop3DLibraryItemCommand;
|
||||
class View3DClosedCommand;
|
||||
|
||||
class NodeInstanceClientInterface
|
||||
{
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
virtual void debugOutput(const DebugOutputCommand &command) = 0;
|
||||
virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
|
||||
virtual void library3DItemDropped(const Drop3DLibraryItemCommand &command) = 0;
|
||||
virtual void view3DClosed(const View3DClosedCommand &command) = 0;
|
||||
|
||||
virtual void flush() {}
|
||||
virtual void synchronizeWithClientProcess() {}
|
||||
|
@@ -63,12 +63,13 @@
|
||||
#include "endpuppetcommand.h"
|
||||
#include "debugoutputcommand.h"
|
||||
#include "puppetalivecommand.h"
|
||||
#include "view3dclosedcommand.h"
|
||||
|
||||
#include <enumeration.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static bool isRegistered=false;
|
||||
static bool isRegistered = false;
|
||||
|
||||
NodeInstanceServerInterface::NodeInstanceServerInterface(QObject *parent) :
|
||||
QObject(parent)
|
||||
@@ -205,6 +206,9 @@ void NodeInstanceServerInterface::registerCommands()
|
||||
|
||||
qRegisterMetaType<PuppetAliveCommand>("PuppetAliveCommand");
|
||||
qRegisterMetaTypeStreamOperators<PuppetAliveCommand>("PuppetAliveCommand");
|
||||
|
||||
qRegisterMetaType<View3DClosedCommand>("View3DClosedCommand");
|
||||
qRegisterMetaTypeStreamOperators<View3DClosedCommand>("View3DClosedCommand");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,6 +61,7 @@
|
||||
#include "removesharedmemorycommand.h"
|
||||
#include "objectnodeinstance.h"
|
||||
#include "drop3dlibraryitemcommand.h"
|
||||
#include "view3dclosedcommand.h"
|
||||
|
||||
#include "dummycontextobject.h"
|
||||
#include "../editor3d/generalhelper.h"
|
||||
@@ -97,6 +98,10 @@ bool Qt5InformationNodeInstanceServer::eventFilter(QObject *, QEvent *event)
|
||||
|
||||
} break;
|
||||
|
||||
case QEvent::Close: {
|
||||
nodeInstanceClient()->view3DClosed(View3DClosedCommand());
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -142,6 +142,7 @@ extend_qtc_plugin(QmlDesigner
|
||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||
enable3dviewcommand.cpp enable3dviewcommand.h
|
||||
view3dclosedcommand.cpp view3dclosedcommand.h
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
|
@@ -462,6 +462,9 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN
|
||||
if (isInvisible)
|
||||
newNode.deselectNode();
|
||||
}
|
||||
} else if (name == "3d-view") {
|
||||
bool is3DEnabled = data.isNull() || data.toBool();
|
||||
formEditorWidget()->option3DAction()->set3DEnabled(is3DEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -138,6 +138,7 @@ public:
|
||||
|
||||
void selectionChanged(const ChangeSelectionCommand &command) override;
|
||||
void library3DItemDropped(const Drop3DLibraryItemCommand &command) override;
|
||||
void view3DClosed(const View3DClosedCommand &command) override;
|
||||
|
||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList) override;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <changenodesourcecommand.h>
|
||||
#include <changeselectioncommand.h>
|
||||
#include <drop3dlibraryitemcommand.h>
|
||||
#include <view3dclosedcommand.h>
|
||||
|
||||
#include <informationchangedcommand.h>
|
||||
#include <pixmapchangedcommand.h>
|
||||
@@ -285,6 +286,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
|
||||
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
|
||||
static const int changeSelectionCommandType = QMetaType::type("ChangeSelectionCommand");
|
||||
static const int drop3DLibraryItemCommandType = QMetaType::type("Drop3DLibraryItemCommand");
|
||||
static const int view3DClosedCommand = QMetaType::type("View3DClosedCommand");
|
||||
|
||||
if (m_destructing)
|
||||
return;
|
||||
@@ -312,6 +314,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
|
||||
nodeInstanceClient()->selectionChanged(command.value<ChangeSelectionCommand>());
|
||||
} else if (command.userType() == drop3DLibraryItemCommandType) {
|
||||
nodeInstanceClient()->library3DItemDropped(command.value<Drop3DLibraryItemCommand>());
|
||||
} else if (command.userType() == view3DClosedCommand) {
|
||||
nodeInstanceClient()->view3DClosed(command.value<View3DClosedCommand>());
|
||||
} else if (command.userType() == puppetAliveCommandType) {
|
||||
puppetAlive(puppetStreamType);
|
||||
} else if (command.userType() == synchronizeCommandType) {
|
||||
|
@@ -1454,6 +1454,13 @@ void NodeInstanceView::library3DItemDropped(const Drop3DLibraryItemCommand &comm
|
||||
QmlVisualNode::createQmlVisualNode(this, itemLibraryEntry, {});
|
||||
}
|
||||
|
||||
void NodeInstanceView::view3DClosed(const View3DClosedCommand &command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
rootModelNode().setAuxiliaryData("3d-view", false);
|
||||
}
|
||||
|
||||
void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> & /*lastSelectedNodeList*/)
|
||||
{
|
||||
|
@@ -175,6 +175,8 @@ Project {
|
||||
"commands/update3dviewstatecommand.h",
|
||||
"commands/enable3dviewcommand.cpp",
|
||||
"commands/enable3dviewcommand.h",
|
||||
"commands/view3dclosedcommand.cpp",
|
||||
"commands/view3dclosedcommand.h",
|
||||
"container/addimportcontainer.cpp",
|
||||
"container/addimportcontainer.h",
|
||||
"container/idcontainer.cpp",
|
||||
|
@@ -48,6 +48,7 @@ extend_qtc_executable(qml2puppet
|
||||
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
|
||||
update3dviewstatecommand.cpp update3dviewstatecommand.h
|
||||
enable3dviewcommand.cpp enable3dviewcommand.h
|
||||
view3dclosedcommand.cpp view3dclosedcommand.h
|
||||
valueschangedcommand.cpp
|
||||
)
|
||||
|
||||
|
@@ -101,6 +101,8 @@ QtcTool {
|
||||
"commands/update3dviewstatecommand.h",
|
||||
"commands/enable3dviewcommand.cpp",
|
||||
"commands/enable3dviewcommand.h",
|
||||
"commands/view3dclosedcommand.cpp",
|
||||
"commands/view3dclosedcommand.h",
|
||||
"container/addimportcontainer.cpp",
|
||||
"container/addimportcontainer.h",
|
||||
"container/idcontainer.cpp",
|
||||
|
Reference in New Issue
Block a user