diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2016-06-28 15:09:22 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2016-06-29 10:14:25 +0000 |
commit | ebf68a988d8893f6742c231aec0bb8a01d922c1e (patch) | |
tree | f5017c4c7612733ad428cc9450d2c7212af2f15d | |
parent | a6e6b2c7726e6d039a35858fa5706a2d69c434a0 (diff) |
Change embedded editor in creator to use desing mode
Change-Id: I3b25ee80fd55c9834d156c6eb1965b645f2924a8
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | creatorplugin/creatorplugin.pro | 10 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorconstants.h | 3 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorcontext.cpp (renamed from creatorplugin/qt3dsceneeditorfactory.cpp) | 32 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorcontext.h (renamed from creatorplugin/qt3dsceneeditorfactory.h) | 20 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditordocument.cpp | 183 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditordocument.h | 73 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorplugin.cpp | 86 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorplugin.h | 14 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorwidget.cpp (renamed from creatorplugin/qt3dsceneeditorw.cpp) | 50 | ||||
-rw-r--r-- | creatorplugin/qt3dsceneeditorwidget.h (renamed from creatorplugin/qt3dsceneeditorw.h) | 30 |
10 files changed, 144 insertions, 357 deletions
diff --git a/creatorplugin/creatorplugin.pro b/creatorplugin/creatorplugin.pro index b9f3d15..6966b20 100644 --- a/creatorplugin/creatorplugin.pro +++ b/creatorplugin/creatorplugin.pro @@ -8,16 +8,14 @@ INCLUDEPATH += ../editorlib # Qt3DSceneEditor files SOURCES += qt3dsceneeditorplugin.cpp \ - qt3dsceneeditorfactory.cpp \ - qt3dsceneeditorw.cpp \ - qt3dsceneeditordocument.cpp + qt3dsceneeditorwidget.cpp \ + qt3dsceneeditorcontext.cpp HEADERS += qt3dsceneeditorplugin.h \ - qt3dsceneeditorfactory.h \ - qt3dsceneeditorw.h \ qt3dsceneeditor_global.h \ qt3dsceneeditorconstants.h \ - qt3dsceneeditordocument.h + qt3dsceneeditorwidget.h \ + qt3dsceneeditorcontext.h RESOURCES += creatorplugin.qrc diff --git a/creatorplugin/qt3dsceneeditorconstants.h b/creatorplugin/qt3dsceneeditorconstants.h index c4ef899..af8f125 100644 --- a/creatorplugin/qt3dsceneeditorconstants.h +++ b/creatorplugin/qt3dsceneeditorconstants.h @@ -31,9 +31,6 @@ namespace Qt3DSceneEditor { namespace Constants { -const char ACTION_ID[] = "Qt3DSceneEditor.Action"; -const char MENU_ID[] = "Qt3DSceneEditor.Menu"; - const char C_QT3DSCENEEDITOR[] = "Qt5.Qt3DSceneEditor"; const char QT3DSCENEEDITOR_ID[] = "Qt5.Qt3DSceneEditor"; const char C_QT3DSCENEEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt3D Scene Editor"); diff --git a/creatorplugin/qt3dsceneeditorfactory.cpp b/creatorplugin/qt3dsceneeditorcontext.cpp index 96f4bf2..c63d04c 100644 --- a/creatorplugin/qt3dsceneeditorfactory.cpp +++ b/creatorplugin/qt3dsceneeditorcontext.cpp @@ -26,33 +26,19 @@ ** ****************************************************************************/ -#include "qt3dsceneeditorfactory.h" -#include "qt3dsceneeditorw.h" -#include "qt3dsceneeditorplugin.h" +#include "qt3dsceneeditorcontext.h" #include "qt3dsceneeditorconstants.h" +#include "qt3dsceneeditorwidget.h" -#include <coreplugin/fileiconprovider.h> -#include <coreplugin/editormanager/editormanager.h> -#include <projectexplorer/projectexplorerconstants.h> +namespace Qt3DSceneEditor { +namespace Internal { -using namespace Qt3DSceneEditor::Internal; -using namespace Qt3DSceneEditor::Constants; - -Qt3DSceneEditorFactory::Qt3DSceneEditorFactory(Qt3DSceneEditorPlugin *plugin) : - Core::IEditorFactory(plugin), - m_plugin(plugin) +Qt3DSceneEditorContext::Qt3DSceneEditorContext(QWidget *widget) + : IContext(widget) { - setId(QT3DSCENEEDITOR_ID); - setMimeTypes(QStringList(QLatin1String(C_QT3DSCENEEDITOR_MIMETYPE))); - setDisplayName(qApp->translate("OpenWith::Editors", C_QT3DSCENEEDITOR_DISPLAY_NAME)); - - // TODO: Do we need special icon for qt3d.qrc files? -// Core::FileIconProvider::registerIconOverlayForSuffix( -// ProjectExplorer::Constants::FILEOVERLAY_QRC, "qt3d.qrc"); + setWidget(widget); } -Core::IEditor *Qt3DSceneEditorFactory::createEditor() -{ - Core::Context context(C_QT3DSCENEEDITOR); - return new Qt3DSceneEditorW(context, m_plugin); } +} + diff --git a/creatorplugin/qt3dsceneeditorfactory.h b/creatorplugin/qt3dsceneeditorcontext.h index 91d901e..4a363a2 100644 --- a/creatorplugin/qt3dsceneeditorfactory.h +++ b/creatorplugin/qt3dsceneeditorcontext.h @@ -28,28 +28,16 @@ #pragma once -#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/icontext.h> -#include <QStringList> - namespace Qt3DSceneEditor { namespace Internal { -class Qt3DSceneEditorPlugin; - -class Qt3DSceneEditorFactory : public Core::IEditorFactory +class Qt3DSceneEditorContext : public Core::IContext { - Q_OBJECT - public: - explicit Qt3DSceneEditorFactory(Qt3DSceneEditorPlugin *plugin); - - Core::IEditor *createEditor(); - -private: - Qt3DSceneEditorPlugin *m_plugin; + Qt3DSceneEditorContext(QWidget *widget); }; -} // namespace Internal -} // namespace Qt3DSceneEditor +} +} diff --git a/creatorplugin/qt3dsceneeditordocument.cpp b/creatorplugin/qt3dsceneeditordocument.cpp deleted file mode 100644 index febea51..0000000 --- a/creatorplugin/qt3dsceneeditordocument.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D Editor of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qt3dsceneeditordocument.h" -#include "qt3dsceneeditorplugin.h" -#include "qt3dsceneeditorconstants.h" - -#include <coreplugin/icore.h> -#include <coreplugin/editormanager/editormanager.h> - -using namespace Utils; - -namespace Qt3DSceneEditor { -namespace Internal { - -enum { debugQt3DSceneEditorDocument = 0 }; - -Qt3DSceneEditorDocument::Qt3DSceneEditorDocument(QObject *parent) : - IDocument(parent) -{ - setId(Qt3DSceneEditor::Constants::QT3DSCENEEDITOR_ID); - setMimeType(QLatin1String(Qt3DSceneEditor::Constants::C_QT3DSCENEEDITOR_MIMETYPE)); - - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; -} - -Core::IDocument::OpenResult Qt3DSceneEditorDocument::open(QString *errorString, - const QString &fileName, - const QString &realFileName) -{ - Q_UNUSED(errorString) - - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__ << fileName << realFileName; - - setBlockDirtyChanged(true); - - // TODO: How to pass the actual file to open to launched editor? - - setFilePath(FileName::fromString(fileName)); - setBlockDirtyChanged(false); - m_shouldAutoSave = false; - - emit loaded(true); - return OpenResult::Success; -} - -bool Qt3DSceneEditorDocument::save(QString *errorString, const QString &name, bool autoSave) -{ - Q_UNUSED(errorString) - - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__ << name << autoSave; - - const FileName oldFileName = filePath(); - const FileName actualName = name.isEmpty() ? oldFileName : FileName::fromString(name); - if (actualName.isEmpty()) - return false; - - m_blockDirtyChanged = true; - - // TODO: How to pass the save command to editor - - m_shouldAutoSave = false; - if (autoSave) { - m_blockDirtyChanged = false; - return true; - } - - setFilePath(actualName); - m_blockDirtyChanged = false; - - emit changed(); - return true; -} - -QByteArray Qt3DSceneEditorDocument::contents() const -{ - // TODO: is this function actually needed? - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; - return QByteArray(); -} - -bool Qt3DSceneEditorDocument::setContents(const QByteArray &contents) -{ - Q_UNUSED(contents) - // TODO: Do we need this? - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; - return true; -} - -void Qt3DSceneEditorDocument::setFilePath(const FileName &newName) -{ - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; - IDocument::setFilePath(newName); -} - -void Qt3DSceneEditorDocument::setBlockDirtyChanged(bool value) -{ - m_blockDirtyChanged = value; -} - -void Qt3DSceneEditorDocument::setShouldAutoSave(bool save) -{ - m_shouldAutoSave = save; -} - -bool Qt3DSceneEditorDocument::shouldAutoSave() const -{ - return m_shouldAutoSave; -} - -bool Qt3DSceneEditorDocument::isModified() const -{ - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; - return false; -} - -bool Qt3DSceneEditorDocument::isSaveAsAllowed() const -{ - return true; -} - -bool Qt3DSceneEditorDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type) -{ - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__; - if (flag == FlagIgnore) - return true; - if (type == TypePermissions) { - emit changed(); - } else { - emit aboutToReload(); - QString fn = filePath().toString(); - const bool success = (open(errorString, fn, fn) == OpenResult::Success); - emit reloadFinished(success); - return success; - } - return true; -} - -void Qt3DSceneEditorDocument::dirtyChanged(bool dirty) -{ - if (m_blockDirtyChanged) - return; // We emit changed() afterwards, unless it was an autosave - - if (debugQt3DSceneEditorDocument) - qDebug() << __FUNCTION__ << dirty; - emit changed(); -} - -} // namespace Internal -} // namespace Qt3DSceneEditor diff --git a/creatorplugin/qt3dsceneeditordocument.h b/creatorplugin/qt3dsceneeditordocument.h deleted file mode 100644 index 31c3833..0000000 --- a/creatorplugin/qt3dsceneeditordocument.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D Editor of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#pragma once - -#include <coreplugin/idocument.h> - - -namespace Qt3DSceneEditor { -namespace Internal { - -class Qt3DSceneEditorPlugin; -class Qt3DSceneEditorW; - -class Qt3DSceneEditorDocument - : public Core::IDocument -{ - Q_OBJECT -public: - Qt3DSceneEditorDocument(QObject *parent = 0); - ~Qt3DSceneEditorDocument() {} - - //IDocument - OpenResult open(QString *errorString, const QString &fileName, - const QString &realFileName) override; - bool save(QString *errorString, const QString &fileName, bool autoSave) override; - QByteArray contents() const override; - bool setContents(const QByteArray &contents) override; - bool shouldAutoSave() const override; - bool isModified() const override; - bool isSaveAsAllowed() const override; - bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override; - void setFilePath(const Utils::FileName &newName) override; - void setBlockDirtyChanged(bool value); - void setShouldAutoSave(bool save); - -signals: - void loaded(bool success); - -private: - void dirtyChanged(bool); - - bool m_blockDirtyChanged = false; - bool m_shouldAutoSave = false; -}; - -} // namespace Internal -} // namespace Qt3DSceneEditor diff --git a/creatorplugin/qt3dsceneeditorplugin.cpp b/creatorplugin/qt3dsceneeditorplugin.cpp index de363c6..51c43f6 100644 --- a/creatorplugin/qt3dsceneeditorplugin.cpp +++ b/creatorplugin/qt3dsceneeditorplugin.cpp @@ -26,8 +26,9 @@ ** ****************************************************************************/ #include "qt3dsceneeditorplugin.h" -#include "qt3dsceneeditorfactory.h" #include "qt3dsceneeditorconstants.h" +#include "qt3dsceneeditorcontext.h" +#include "qt3dsceneeditorwidget.h" #include "../editorlib/src/qt3dsceneeditor.h" #include <coreplugin/icore.h> @@ -35,16 +36,20 @@ #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/actioncontainer.h> +#include <coreplugin/modemanager.h> +#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/designmode.h> +#include <coreplugin/editormanager/ieditor.h> #include <utils/mimetypes/mimedatabase.h> +#include <QtCore/QTimer> + namespace Qt3DSceneEditor { namespace Internal { -Qt3DSceneEditorPlugin::Qt3DSceneEditorPlugin() : - m_qmlEngine(nullptr) +Qt3DSceneEditorPlugin::Qt3DSceneEditorPlugin() { // Create your members } @@ -52,8 +57,13 @@ Qt3DSceneEditorPlugin::Qt3DSceneEditorPlugin() : Qt3DSceneEditorPlugin::~Qt3DSceneEditorPlugin() { // Unregister objects from the plugin manager's object pool - // Delete members - delete m_qmlEngine; + if (m_sceneEditorWidget) + Core::DesignMode::instance()->unregisterDesignWidget(m_sceneEditorWidget); + if (m_context) + Core::ICore::removeContextObject(m_context); + + delete m_context; + delete m_sceneEditorWidget; } bool Qt3DSceneEditorPlugin::initialize(const QStringList &arguments, QString *errorString) @@ -70,8 +80,7 @@ bool Qt3DSceneEditorPlugin::initialize(const QStringList &arguments, QString *er Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qt3deditorplugin/mimetypes.xml")); - Qt3DSceneEditorFactory *editor = new Qt3DSceneEditorFactory(this); - addAutoReleasedObject(editor); + createSceneEditorWidget(); return true; } @@ -81,9 +90,12 @@ void Qt3DSceneEditorPlugin::extensionsInitialized() // Retrieve objects from the plugin manager's object pool // In the extensionsInitialized function, a plugin can be sure that all // plugins that depend on it are completely initialized. + QStringList mimeTypes; + mimeTypes.append(Qt3DSceneEditor::Constants::C_QT3DSCENEEDITOR_MIMETYPE); - // TODO: How to enable design mode properly, as this doesn't seem to work - //Core::DesignMode::instance()->setDesignModeIsRequired(); + Core::DesignMode::instance()->registerDesignWidget(m_sceneEditorWidget, mimeTypes, + m_context->context()); + Core::DesignMode::instance()->setDesignModeIsRequired(); } ExtensionSystem::IPlugin::ShutdownFlag Qt3DSceneEditorPlugin::aboutToShutdown() @@ -96,5 +108,61 @@ ExtensionSystem::IPlugin::ShutdownFlag Qt3DSceneEditorPlugin::aboutToShutdown() return SynchronousShutdown; } +static bool isSceneEditorDocument(Core::IEditor *editor) { + return editor && editor->document() && editor->document()->mimeType() + == Qt3DSceneEditor::Constants::C_QT3DSCENEEDITOR_MIMETYPE; +} + +static bool isDesignerMode(Core::Id mode) +{ + return mode == Core::DesignMode::instance()->id(); +} + +void Qt3DSceneEditorPlugin::createSceneEditorWidget() +{ + m_sceneEditorWidget = new Qt3DSceneEditorWidget; + m_context = new Qt3DSceneEditorContext(m_sceneEditorWidget); + Core::ICore::addContextObject(m_context); + + connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, + [=] (Core::IEditor *editor) { + if (isSceneEditorDocument(editor) && !isDesignerMode(Core::ModeManager::currentMode())) { + showSceneEditor(); + QTimer::singleShot(0, this, [] () { + Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN); + }); + } + }); + + connect(Core::EditorManager::instance(), &Core::EditorManager::editorsClosed, + [=] (QList<Core::IEditor *> editors) { + Q_FOREACH (Core::IEditor *editor, editors) { + if (isSceneEditorDocument(editor)) + hideSceneEditor(); + } + }); + + connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, + [=] (Core::Id newMode, Core::Id oldMode) { + if (!isDesignerMode(newMode) && isDesignerMode(oldMode)) { + hideSceneEditor(); + } else if (isSceneEditorDocument(Core::EditorManager::currentEditor()) + && isDesignerMode(newMode)) { + showSceneEditor(); + } + }); +} + +void Qt3DSceneEditorPlugin::showSceneEditor() +{ + m_sceneEditorWidget->initialize(); + // TODO: load the scene (probably as parameter to initialize) +} + +void Qt3DSceneEditorPlugin::hideSceneEditor() +{ + // TODO: should save settings on qml side? +} + } // namespace Internal } // namespace Qt3DSceneEditor diff --git a/creatorplugin/qt3dsceneeditorplugin.h b/creatorplugin/qt3dsceneeditorplugin.h index b7719fc..61ee576 100644 --- a/creatorplugin/qt3dsceneeditorplugin.h +++ b/creatorplugin/qt3dsceneeditorplugin.h @@ -31,11 +31,13 @@ #include "qt3dsceneeditor_global.h" #include <extensionsystem/iplugin.h> -#include <QtQml/QQmlApplicationEngine> namespace Qt3DSceneEditor { namespace Internal { +class Qt3DSceneEditorWidget; +class Qt3DSceneEditorContext; + class Qt3DSceneEditorPlugin : public ExtensionSystem::IPlugin { Q_OBJECT @@ -49,8 +51,16 @@ public: void extensionsInitialized(); ShutdownFlag aboutToShutdown(); + Qt3DSceneEditorWidget *sceneEditorWidget() const { return m_sceneEditorWidget; } + + void showSceneEditor(); + void hideSceneEditor(); + private: - QQmlApplicationEngine *m_qmlEngine; + void createSceneEditorWidget(); + + Qt3DSceneEditorWidget *m_sceneEditorWidget; + Qt3DSceneEditorContext *m_context; }; } // namespace Internal diff --git a/creatorplugin/qt3dsceneeditorw.cpp b/creatorplugin/qt3dsceneeditorwidget.cpp index b059185..eab05f2 100644 --- a/creatorplugin/qt3dsceneeditorw.cpp +++ b/creatorplugin/qt3dsceneeditorwidget.cpp @@ -26,49 +26,51 @@ ** ****************************************************************************/ -#include "qt3dsceneeditorw.h" -#include "qt3dsceneeditorplugin.h" -#include "qt3dsceneeditordocument.h" -#include "qt3dsceneeditorconstants.h" +#include "qt3dsceneeditorwidget.h" #include "../editorlib/src/qt3dsceneeditor.h" +#include <QBoxLayout> #include <QQuickWidget> -using namespace Utils; +using namespace Qt3DSceneEditor; namespace Qt3DSceneEditor { namespace Internal { -enum { debugQt3DSceneEditorW = 0 }; +Qt3DSceneEditorWidget::Qt3DSceneEditorWidget(QWidget *parent) + : QWidget(parent) + , m_sceneEditor(nullptr) +{ +} -Qt3DSceneEditorW::Qt3DSceneEditorW(const Core::Context &context, - Qt3DSceneEditorPlugin *plugin, - QWidget *parent) - : m_document(new Qt3DSceneEditorDocument(this)), - m_plugin(plugin), - m_sceneEditor(nullptr) +Qt3DSceneEditorWidget::~Qt3DSceneEditorWidget() +{ +} + +void Qt3DSceneEditorWidget::setup() { Qt3DSceneEditorLib::register3DSceneEditorQML(); - m_sceneEditor = new QQuickWidget(parent); + m_sceneEditor = new QQuickWidget(this); m_sceneEditor->setResizeMode(QQuickWidget::SizeRootObjectToView); m_sceneEditor->setSource(QUrl(QStringLiteral("qrc:/qt3deditorlib/PluginMain.qml"))); - setContext(context); - setWidget(m_sceneEditor); + QVBoxLayout *layout = new QVBoxLayout(); + layout->setMargin(0); + layout->setSpacing(0); + layout->addWidget(m_sceneEditor); + setLayout(layout); - if (debugQt3DSceneEditorW) - qDebug() << __FUNCTION__; + show(); } -Qt3DSceneEditorW::~Qt3DSceneEditorW() +void Qt3DSceneEditorWidget::initialize() { - if (m_sceneEditor) - m_sceneEditor->deleteLater(); -} + if (m_initStatus == NotInitialized) { + m_initStatus = Initializing; + setup(); + } -QWidget *Qt3DSceneEditorW::toolBar() -{ - return nullptr; + m_initStatus = Initialized; } } // namespace Internal diff --git a/creatorplugin/qt3dsceneeditorw.h b/creatorplugin/qt3dsceneeditorwidget.h index 40b682e..09a9138 100644 --- a/creatorplugin/qt3dsceneeditorw.h +++ b/creatorplugin/qt3dsceneeditorwidget.h @@ -28,10 +28,7 @@ #pragma once -#include "qt3dsceneeditordocument.h" - -#include <coreplugin/idocument.h> -#include <coreplugin/editormanager/ieditor.h> +#include <QWidget> QT_BEGIN_NAMESPACE class QQuickWidget; @@ -40,26 +37,23 @@ QT_END_NAMESPACE namespace Qt3DSceneEditor { namespace Internal { -class Qt3DSceneEditorPlugin; -class Qt3DSceneEditorDocument; - -class Qt3DSceneEditorW : public Core::IEditor +class Qt3DSceneEditorWidget : public QWidget { Q_OBJECT public: - Qt3DSceneEditorW(const Core::Context &context, - Qt3DSceneEditorPlugin *plugin, - QWidget *parent = 0); - ~Qt3DSceneEditorW() override; + explicit Qt3DSceneEditorWidget(QWidget *parent = 0); + + ~Qt3DSceneEditorWidget(); + + void initialize(); - // IEditor - Core::IDocument *document() override { return m_document; } - QWidget *toolBar() override; +private: // functions + enum InitializeStatus { NotInitialized, Initializing, Initialized }; + void setup(); -private: - Qt3DSceneEditorDocument *m_document; - Qt3DSceneEditorPlugin *m_plugin; +private: // variables + InitializeStatus m_initStatus = NotInitialized; QQuickWidget *m_sceneEditor; }; |