summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-12-11 21:29:10 +0200
committerMahmoud Badri <mahmoud.badri@qt.io>2019-12-13 12:40:43 +0000
commitf97de35dd4af80fa5f3d4229ac4aa8519d9e1d38 (patch)
treeebc8244942f8014726a7166464f3cc8153d6de21 /src/plugins
parentc2bfdff70b4d539e719d7eb78a59ed4214b683f4 (diff)
downloadqt-creator-f97de35dd4af80fa5f3d4229ac4aa8519d9e1d38.tar.gz
Improve edit view 3D "on top" logicqds/v1.4.0-rc1
- Proxy dialog removed - When the QDS window is minimized/maximized, the edit view 3D follows. The opposite is not true (edit view 3D can be minimized separately). - Edit view 3D is always on top of QDS window. Only exception is when a popup is shown (so that the user can handle the popup). - External apps go normally on top of the edit view 3D. Known (non critical) issues: - Activating the edit view 3D doesn't raise() the QDS window, so if an external app is on top of the edit view 3D then the view is clicked, the external app will be in between the view and the QDS window. - Closing the edit view 3D from the x button doesnt work (causes a restart). This is not in the scope of this commit. Task-number: QDS-1179 Change-Id: I1dd72590037be295b94735de96772307ba14c59c Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/coreplugin/icore.h2
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp13
-rw-r--r--src/plugins/coreplugin/mainwindow.h2
-rw-r--r--src/plugins/qmldesigner/CMakeLists.txt4
-rw-r--r--src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp168
-rw-r--r--src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h67
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditor.pri2
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp5
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp15
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorwidget.h5
-rw-r--r--src/plugins/qmldesigner/designercore/include/nodeinstanceview.h9
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp10
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h3
-rw-r--r--src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp34
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp11
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.qbs8
16 files changed, 60 insertions, 298 deletions
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index b338839110..783f890599 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -164,6 +164,8 @@ 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 */
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 94e5aa78fe..da53dd7528 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -201,6 +201,19 @@ MainWindow::MainWindow()
this, &MainWindow::openDroppedFiles);
}
+// Edit View 3D needs to know when the main windows'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) {
+ auto lastChild = qobject_cast<QWidget *>(children().last());
+ bool hasPopup = lastChild && lastChild->isActiveWindow();
+ 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 26dc607cbe..a3a537b231 100644
--- a/src/plugins/coreplugin/mainwindow.h
+++ b/src/plugins/coreplugin/mainwindow.h
@@ -114,6 +114,7 @@ public slots:
protected:
void closeEvent(QCloseEvent *event) override;
+ void changeEvent(QEvent *event) override;
private:
void openFile();
@@ -192,6 +193,7 @@ private:
QToolButton *m_toggleRightSideBarButton = nullptr;
QColor m_overrideColor;
QList<std::function<bool()>> 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 1685aeaa79..6d3bca379c 100644
--- a/src/plugins/qmldesigner/CMakeLists.txt
+++ b/src/plugins/qmldesigner/CMakeLists.txt
@@ -140,7 +140,8 @@ extend_qtc_plugin(QmlDesigner
valueschangedcommand.cpp valueschangedcommand.h
changeselectioncommand.cpp changeselectioncommand.h
drop3dlibraryitemcommand.cpp drop3dlibraryitemcommand.h
- change3dviewcommand.cpp change3dviewcommand.h
+ update3dviewstatecommand.cpp update3dviewstatecommand.h
+ enable3dviewcommand.cpp enable3dviewcommand.h
)
extend_qtc_plugin(QmlDesigner
@@ -235,7 +236,6 @@ extend_qtc_plugin(QmlDesigner
snappinglinecreator.cpp snappinglinecreator.h
toolbox.cpp toolbox.h
option3daction.cpp option3daction.h
- editview3dproxydialog.cpp editview3dproxydialog.h
)
extend_qtc_plugin(QmlDesigner
diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp b/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp
deleted file mode 100644
index 505eeacd1f..0000000000
--- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.cpp
+++ /dev/null
@@ -1,168 +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 "editview3dproxydialog.h"
-#include "formeditorview.h"
-
-#include <nodeinstanceview.h>
-
-#include <coreplugin/icore.h>
-
-#include <utils/hostosinfo.h>
-
-#include <QApplication>
-#include <QMouseEvent>
-#include <QStyle>
-#include <QWindow>
-
-namespace QmlDesigner {
-
-const int borderOffset = 8;
-
-static int titleBarHeight() {
- return QApplication::style()->pixelMetric(QStyle::PM_TitleBarHeight);
-}
-
-EditView3DProxyDialog::EditView3DProxyDialog(FormEditorView *view) :
- QDialog(Core::ICore::dialogParent())
- ,m_formEditorView(view)
-{
- setFocusPolicy(Qt::ClickFocus);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- if (Utils::HostOsInfo::isMacHost()) {
- setWindowFlag(Qt::Tool);
- setAttribute(Qt::WA_MacAlwaysShowToolWindow);
- }
-
- resize(1024, 768);
-}
-
-void EditView3DProxyDialog::invalidate()
-{
- if (nodeInstanceView() && isVisible())
- nodeInstanceView()->show3DView(adjustedRect());
-}
-
-void EditView3DProxyDialog::moveEvent(QMoveEvent *event)
-{
- if (nodeInstanceView())
- nodeInstanceView()->move3DView(pos() + QPoint(borderOffset, titleBarHeight() + 2 * borderOffset));
-
- QDialog::moveEvent(event);
-}
-
-void EditView3DProxyDialog::closeEvent(QCloseEvent *event)
-{
- if (m_formEditorView) {
- m_formEditorView->toggle3DViewEnabled(false);
- m_formEditorView->setupOption3DAction();
- }
-
- nodeInstanceView()->hide3DView();
-
- QDialog::closeEvent(event);
-}
-
-void EditView3DProxyDialog::hideEvent(QHideEvent *event)
-{
- if (m_formEditorView) {
- m_formEditorView->toggle3DViewEnabled(false);
- m_formEditorView->setupOption3DAction();
- }
-
- nodeInstanceView()->hide3DView();
-
- QDialog::hideEvent(event);
-}
-
-void EditView3DProxyDialog::focusOutEvent(QFocusEvent *event)
-{
- if (isVisible())
- showView();
-
- QDialog::focusOutEvent(event);
-}
-
-void EditView3DProxyDialog::focusInEvent(QFocusEvent *event)
-{
- showView();
-
- QDialog::focusInEvent(event);
-}
-
-void EditView3DProxyDialog::resizeEvent(QResizeEvent *event)
-{
- if (nodeInstanceView())
- nodeInstanceView()->show3DView(adjustedRect());
-
- QDialog::resizeEvent(event);
-}
-
-bool EditView3DProxyDialog::event(QEvent *event)
-{
- if (event->type() == QEvent::WindowActivate) {
- showView();
- } else if (event->type() == QEvent::NonClientAreaMouseButtonPress) {
- auto mouseMoveEvent = static_cast<QMouseEvent *>(event);
- if (mouseMoveEvent->buttons() & Qt::LeftButton)
- hideView();
- } else if (event->type() == QEvent::NonClientAreaMouseButtonRelease) {
- auto mouseMoveEvent = static_cast<QMouseEvent *>(event);
- if (mouseMoveEvent->buttons() & Qt::LeftButton)
- showView();
- }
-
- return QDialog::event(event);
-}
-
-QRect EditView3DProxyDialog::adjustedRect() const
-{
- return QRect(pos(), size()).adjusted(borderOffset,
- titleBarHeight() + 2 * borderOffset,
- -borderOffset, titleBarHeight());
-}
-
-NodeInstanceView *EditView3DProxyDialog::nodeInstanceView() const
-{
- if (m_formEditorView)
- return m_formEditorView->nodeInstanceView();
-
- return nullptr;
-}
-
-void EditView3DProxyDialog::showView()
-{
- if (nodeInstanceView())
- nodeInstanceView()->show3DView(adjustedRect());
-}
-
-void EditView3DProxyDialog::hideView()
-{
- if (nodeInstanceView())
- nodeInstanceView()->hide3DView();
-}
-
-} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h b/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h
deleted file mode 100644
index 717deca7f9..0000000000
--- a/src/plugins/qmldesigner/components/formeditor/editview3dproxydialog.h
+++ /dev/null
@@ -1,67 +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 "abstractcustomtool.h"
-
-#include <QObject>
-#include <QDialog>
-
-namespace QmlDesigner {
-
-class FormEditorView;
-class NodeInstanceView;
-
-class EditView3DProxyDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit EditView3DProxyDialog(FormEditorView *view);
-
- void invalidate();
-
-protected:
- void moveEvent(QMoveEvent *event) override;
- void closeEvent(QCloseEvent *event) override;
- void hideEvent(QHideEvent *event) override;
- void focusOutEvent(QFocusEvent *event) override;
- void focusInEvent(QFocusEvent *event) override;
- void resizeEvent(QResizeEvent *event) override;
- bool event(QEvent *event) override;
-
-private:
- QRect adjustedRect() const;
- NodeInstanceView *nodeInstanceView() const;
- void showView();
- void hideView();
-
- QPointer<FormEditorView> m_formEditorView;
-
-};
-
-} //QmlDesigner
-
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditor.pri b/src/plugins/qmldesigner/components/formeditor/formeditor.pri
index 15de28f504..5bff19e664 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditor.pri
+++ b/src/plugins/qmldesigner/components/formeditor/formeditor.pri
@@ -1,6 +1,5 @@
VPATH += $$PWD
SOURCES += formeditoritem.cpp \
- editview3dproxydialog.cpp \
formeditorview.cpp \
formeditorscene.cpp \
formeditorwidget.cpp \
@@ -41,7 +40,6 @@ SOURCES += formeditoritem.cpp \
option3daction.cpp
HEADERS += formeditorscene.h \
- editview3dproxydialog.h \
formeditorwidget.h \
formeditoritem.h \
formeditorview.h \
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index 90707a5887..ee7b3f18a9 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -24,6 +24,7 @@
****************************************************************************/
#include "formeditorview.h"
+#include "nodeinstanceview.h"
#include "selectiontool.h"
#include "movetool.h"
#include "option3daction.h"
@@ -475,8 +476,6 @@ void FormEditorView::instancesCompleted(const QVector<ModelNode> &completedNodeL
itemNodeList.append(item);
}
}
- if (node.isRootNode())
- formEditorWidget()->invalidate3DEditor();
}
currentTool()->instancesCompleted(itemNodeList);
}
@@ -598,7 +597,7 @@ void FormEditorView::toggle3DViewEnabled(bool enabled)
else
rootModelNode().setAuxiliaryData("3d-view", false);
- formEditorWidget()->set3dEditorVisibility(enabled);
+ nodeInstanceView()->enable3DView(enabled);
}
QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode)
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
index fdad23a880..f5970dc0e0 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
@@ -24,7 +24,6 @@
****************************************************************************/
#include "designeractionmanager.h"
-#include "editview3dproxydialog.h"
#include "formeditorwidget.h"
#include "formeditorscene.h"
#include "qmldesignerplugin.h"
@@ -174,14 +173,11 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) :
fillLayout->addWidget(m_graphicsView.data());
m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
-
- m_editView3DProxyDialog = new EditView3DProxyDialog(view);
}
void FormEditorWidget::changeTransformTool(bool checked)
{
if (checked)
-
m_formEditorView->changeToTransformTools();
}
@@ -397,17 +393,6 @@ FormEditorGraphicsView *FormEditorWidget::graphicsView() const
return m_graphicsView;
}
-void FormEditorWidget::set3dEditorVisibility(bool b)
-{
- m_editView3DProxyDialog->setVisible(b);
-}
-
-void FormEditorWidget::invalidate3DEditor()
-{
- if (m_editView3DProxyDialog)
- m_editView3DProxyDialog->invalidate();
-}
-
DocumentWarningWidget *FormEditorWidget::errorWidget()
{
if (m_documentErrorWidget.isNull()) {
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
index d1c5588528..f7e0d8a92d 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h
@@ -37,7 +37,6 @@ QT_END_NAMESPACE
namespace QmlDesigner {
-class EditView3DProxyDialog;
class ZoomAction;
class LineEditAction;
class BackgroundAction;
@@ -87,9 +86,6 @@ public:
FormEditorGraphicsView *graphicsView() const;
- void set3dEditorVisibility(bool b);
- void invalidate3DEditor();
-
protected:
void wheelEvent(QWheelEvent *event) override;
QActionGroup *toolActionGroup() const;
@@ -120,7 +116,6 @@ private:
QPointer<Option3DAction> m_option3DAction;
QPointer<QAction> m_resetAction;
QPointer<DocumentWarningWidget> m_documentErrorWidget;
- QPointer<EditView3DProxyDialog> m_editView3DProxyDialog;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
index a6de5fd6c6..f6b705acc3 100644
--- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
+++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
@@ -59,7 +59,6 @@ class CreateSceneCommand;
class CreateInstancesCommand;
class ClearSceneCommand;
class ReparentInstancesCommand;
-class Change3DViewCommand;
class ChangeFileUrlCommand;
class ChangeValuesCommand;
class ChangeBindingsCommand;
@@ -143,15 +142,14 @@ public:
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList) override;
- void show3DView(const QRect &rect);
- void move3DView(const QPoint &position);
- void hide3DView();
+ void mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates);
+ void mainWindowActiveChanged(bool active, bool hasPopup);
+ void enable3DView(bool enable);
protected:
void timerEvent(QTimerEvent *event) override;
private: // functions
- enum ViewAction { Show, Move, Hide };
void activateState(const NodeInstance &instance);
void activateBaseState();
@@ -176,7 +174,6 @@ private: // functions
CreateSceneCommand createCreateSceneCommand();
- Change3DViewCommand createChange3DViewCommand(ViewAction action, const QPoint &pos = {}, const QSize &size = {}) const;
ClearSceneCommand createClearSceneCommand() const;
CreateInstancesCommand createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const;
CompleteComponentCommand createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const;
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
index 39de64f9ae..d979e3dd32 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp
@@ -29,7 +29,8 @@
#include <createinstancescommand.h>
#include <createscenecommand.h>
-#include <change3dviewcommand.h>
+#include <update3dviewstatecommand.h>
+#include <enable3dviewcommand.h>
#include <changevaluescommand.h>
#include <changebindingscommand.h>
#include <changeauxiliarycommand.h>
@@ -652,7 +653,12 @@ void NodeInstanceServerProxy::clearScene(const ClearSceneCommand &command)
writeCommand(QVariant::fromValue(command));
}
-void NodeInstanceServerProxy::change3DView(const Change3DViewCommand &command)
+void NodeInstanceServerProxy::update3DViewState(const Update3dViewStateCommand &command)
+{
+ writeCommand(QVariant::fromValue(command));
+}
+
+void NodeInstanceServerProxy::enable3DView(const Enable3DViewCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
index 62c361dbd1..25dd7bec1f 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h
@@ -69,7 +69,8 @@ public:
void createInstances(const CreateInstancesCommand &command) override;
void changeFileUrl(const ChangeFileUrlCommand &command) override;
void createScene(const CreateSceneCommand &command) override;
- void change3DView(const Change3DViewCommand &command) override;
+ void update3DViewState(const Update3dViewStateCommand &command) override;
+ void enable3DView(const Enable3DViewCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
void changeSelection(const ChangeSelectionCommand &command) override;
diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
index 9aa8d2f41c..9528328754 100644
--- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
@@ -48,7 +48,8 @@
#include "clearscenecommand.h"
#include "changefileurlcommand.h"
#include "reparentinstancescommand.h"
-#include "change3dviewcommand.h"
+#include "update3dviewstatecommand.h"
+#include "enable3dviewcommand.h"
#include "changevaluescommand.h"
#include "changeauxiliarycommand.h"
#include "changebindingscommand.h"
@@ -979,20 +980,6 @@ ClearSceneCommand NodeInstanceView::createClearSceneCommand() const
return {};
}
-Change3DViewCommand NodeInstanceView::createChange3DViewCommand(ViewAction action, const QPoint &pos, const QSize &size) const
-{
- InformationName informationName = InformationName::ShowView;
-
- if (action == ViewAction::Move)
- informationName = InformationName::MoveView;
- else if (action == ViewAction::Hide)
- informationName = InformationName::HideView;
-
- const qint32 instanceId = 0;
-
- return Change3DViewCommand({ InformationContainer(instanceId, informationName, pos, size) });
-}
-
CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const
{
QVector<qint32> containerList;
@@ -1473,21 +1460,22 @@ void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &selectedNode
nodeInstanceServer()->changeSelection(createChangeSelectionCommand(selectedNodeList));
}
-void NodeInstanceView::move3DView(const QPoint &position)
+void NodeInstanceView::mainWindowStateChanged(Qt::WindowStates previousStates, Qt::WindowStates currentStates)
{
- nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Move, position));
+ if (nodeInstanceServer())
+ nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(previousStates, currentStates));
}
-void NodeInstanceView::hide3DView()
+void NodeInstanceView::mainWindowActiveChanged(bool active, bool hasPopup)
{
- nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Hide));
+ if (nodeInstanceServer())
+ nodeInstanceServer()->update3DViewState(Update3dViewStateCommand(active, hasPopup));
}
-void NodeInstanceView::show3DView(const QRect &rect)
+// enable / disable 3D edit View
+void NodeInstanceView::enable3DView(bool enable)
{
- nodeInstanceServer()->change3DView(createChange3DViewCommand(ViewAction::Show,
- rect.topLeft(),
- rect.size()));
+ nodeInstanceServer()->enable3DView(Enable3DViewCommand(enable));
}
void NodeInstanceView::timerEvent(QTimerEvent *event)
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 928c19b02c..0fb5f19f2b 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -31,6 +31,7 @@
#include "designmodecontext.h"
#include "openuiqmlfiledialog.h"
#include "generateresource.h"
+#include "nodeinstanceview.h"
#include <metainfo.h>
#include <connectionview.h>
@@ -249,6 +250,16 @@ 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 7047ffa1b8..1ef8407d8e 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.qbs
+++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs
@@ -171,8 +171,10 @@ Project {
"commands/changeselectioncommand.h",
"commands/drop3dlibraryitemcommand.cpp",
"commands/drop3dlibraryitemcommand.h",
- "commands/change3dviewcommand.cpp",
- "commands/change3dviewcommand.h",
+ "commands/update3dviewstatecommand.cpp",
+ "commands/update3dviewstatecommand.h",
+ "commands/enable3dviewcommand.cpp",
+ "commands/enable3dviewcommand.h",
"container/addimportcontainer.cpp",
"container/addimportcontainer.h",
"container/idcontainer.cpp",
@@ -454,8 +456,6 @@ Project {
"formeditor/controlelement.h",
"formeditor/dragtool.cpp",
"formeditor/dragtool.h",
- "formeditor/editview3dproxydialog.cpp",
- "formeditor/editview3dproxydialog.h",
"formeditor/formeditor.qrc",
"formeditor/formeditorgraphicsview.cpp",
"formeditor/formeditorgraphicsview.h",