summaryrefslogtreecommitdiffstats
path: root/creatorplugin
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-07 12:12:33 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2016-06-28 09:32:08 +0000
commit65885a1f1f3416a426fc78a8514839470d83bced (patch)
treed080f084d05582977a65e4842a863a814edf5f39 /creatorplugin
parent531d8fe22a52b5d0e98096d71dd7d7a81368121c (diff)
Creator plugin launches embedded editor
There's not yet any interaction between embedded editor and creator, such as opening the correct file. Change-Id: I1b8507ca209ba2387e0c1dfa8657bd45560a671a Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'creatorplugin')
-rw-r--r--creatorplugin/creatorplugin.pro13
-rw-r--r--creatorplugin/qt3dsceneeditor_global.h28
-rw-r--r--creatorplugin/qt3dsceneeditorconstants.h36
-rw-r--r--creatorplugin/qt3dsceneeditordocument.cpp183
-rw-r--r--creatorplugin/qt3dsceneeditordocument.h73
-rw-r--r--creatorplugin/qt3dsceneeditorfactory.cpp58
-rw-r--r--creatorplugin/qt3dsceneeditorfactory.h55
-rw-r--r--creatorplugin/qt3dsceneeditorplugin.cpp33
-rw-r--r--creatorplugin/qt3dsceneeditorplugin.h4
-rw-r--r--creatorplugin/qt3dsceneeditorw.cpp75
-rw-r--r--creatorplugin/qt3dsceneeditorw.h67
11 files changed, 595 insertions, 30 deletions
diff --git a/creatorplugin/creatorplugin.pro b/creatorplugin/creatorplugin.pro
index 41fd120..b9f3d15 100644
--- a/creatorplugin/creatorplugin.pro
+++ b/creatorplugin/creatorplugin.pro
@@ -1,17 +1,23 @@
DEFINES += QT3DSCENEEDITOR_LIBRARY
-QT += qml quick
+QT += qml quick quickwidgets
DEPENDPATH += ../editorlib
INCLUDEPATH += ../editorlib
# Qt3DSceneEditor files
-SOURCES += qt3dsceneeditorplugin.cpp
+SOURCES += qt3dsceneeditorplugin.cpp \
+ qt3dsceneeditorfactory.cpp \
+ qt3dsceneeditorw.cpp \
+ qt3dsceneeditordocument.cpp
HEADERS += qt3dsceneeditorplugin.h \
+ qt3dsceneeditorfactory.h \
+ qt3dsceneeditorw.h \
qt3dsceneeditor_global.h \
- qt3dsceneeditorconstants.h
+ qt3dsceneeditorconstants.h \
+ qt3dsceneeditordocument.h
RESOURCES += creatorplugin.qrc
@@ -68,6 +74,7 @@ LIBS += -L$$EDITORLIBDIR -lqt3dsceneeditor
# Install necessary files under creator
editordll.path = $$IDE_BIN_PATH
editordll.files = $$EDITORLIBDIR/$$EDITORLIBNAME
+editordll.CONFIG = no_check_exist
wizardfiles.path = $$IDE_DATA_PATH/templates/wizards/files/qt3dsceneeditor
wizardfiles.files = \
diff --git a/creatorplugin/qt3dsceneeditor_global.h b/creatorplugin/qt3dsceneeditor_global.h
index f233c3e..22a8e1b 100644
--- a/creatorplugin/qt3dsceneeditor_global.h
+++ b/creatorplugin/qt3dsceneeditor_global.h
@@ -1,3 +1,31 @@
+/****************************************************************************
+**
+** 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 <QtGlobal>
diff --git a/creatorplugin/qt3dsceneeditorconstants.h b/creatorplugin/qt3dsceneeditorconstants.h
index 7567024..c4ef899 100644
--- a/creatorplugin/qt3dsceneeditorconstants.h
+++ b/creatorplugin/qt3dsceneeditorconstants.h
@@ -1,3 +1,31 @@
+/****************************************************************************
+**
+** 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
namespace Qt3DSceneEditor {
@@ -6,5 +34,13 @@ 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");
+
+const char C_QT3DSCENEEDITOR_MIMETYPE[] = "application/qt3dsceneeditor";
+
+const char C_OPEN_EDITOR[] = "Qt3DSceneEditor.OpenEditor";
+
} // namespace Qt3DSceneEditor
} // namespace Constants
diff --git a/creatorplugin/qt3dsceneeditordocument.cpp b/creatorplugin/qt3dsceneeditordocument.cpp
new file mode 100644
index 0000000..febea51
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditordocument.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 0000000..31c3833
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditordocument.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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/qt3dsceneeditorfactory.cpp b/creatorplugin/qt3dsceneeditorfactory.cpp
new file mode 100644
index 0000000..96f4bf2
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditorfactory.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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 "qt3dsceneeditorfactory.h"
+#include "qt3dsceneeditorw.h"
+#include "qt3dsceneeditorplugin.h"
+#include "qt3dsceneeditorconstants.h"
+
+#include <coreplugin/fileiconprovider.h>
+#include <coreplugin/editormanager/editormanager.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
+using namespace Qt3DSceneEditor::Internal;
+using namespace Qt3DSceneEditor::Constants;
+
+Qt3DSceneEditorFactory::Qt3DSceneEditorFactory(Qt3DSceneEditorPlugin *plugin) :
+ Core::IEditorFactory(plugin),
+ m_plugin(plugin)
+{
+ 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");
+}
+
+Core::IEditor *Qt3DSceneEditorFactory::createEditor()
+{
+ Core::Context context(C_QT3DSCENEEDITOR);
+ return new Qt3DSceneEditorW(context, m_plugin);
+}
diff --git a/creatorplugin/qt3dsceneeditorfactory.h b/creatorplugin/qt3dsceneeditorfactory.h
new file mode 100644
index 0000000..91d901e
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditorfactory.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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/editormanager/ieditorfactory.h>
+#include <coreplugin/icontext.h>
+
+#include <QStringList>
+
+namespace Qt3DSceneEditor {
+namespace Internal {
+
+class Qt3DSceneEditorPlugin;
+
+class Qt3DSceneEditorFactory : public Core::IEditorFactory
+{
+ Q_OBJECT
+
+public:
+ explicit Qt3DSceneEditorFactory(Qt3DSceneEditorPlugin *plugin);
+
+ Core::IEditor *createEditor();
+
+private:
+ Qt3DSceneEditorPlugin *m_plugin;
+};
+
+} // namespace Internal
+} // namespace Qt3DSceneEditor
diff --git a/creatorplugin/qt3dsceneeditorplugin.cpp b/creatorplugin/qt3dsceneeditorplugin.cpp
index 64a5533..de363c6 100644
--- a/creatorplugin/qt3dsceneeditorplugin.cpp
+++ b/creatorplugin/qt3dsceneeditorplugin.cpp
@@ -26,6 +26,7 @@
**
****************************************************************************/
#include "qt3dsceneeditorplugin.h"
+#include "qt3dsceneeditorfactory.h"
#include "qt3dsceneeditorconstants.h"
#include "../editorlib/src/qt3dsceneeditor.h"
@@ -35,14 +36,10 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h>
+#include <coreplugin/designmode.h>
#include <utils/mimetypes/mimedatabase.h>
-#include <QAction>
-#include <QMessageBox>
-#include <QMainWindow>
-#include <QMenu>
-
namespace Qt3DSceneEditor {
namespace Internal {
@@ -73,15 +70,8 @@ bool Qt3DSceneEditorPlugin::initialize(const QStringList &arguments, QString *er
Utils::MimeDatabase::addMimeTypes(QLatin1String(":/qt3deditorplugin/mimetypes.xml"));
- QAction *action = new QAction(tr("Launch External Qt3D Scene Editor..."), this);
- Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID,
- Core::Context(Core::Constants::C_GLOBAL));
- connect(action, SIGNAL(triggered()), this, SLOT(triggerAction()));
-
- Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
- menu->menu()->setTitle(tr("Qt3D Scene Editor"));
- menu->addAction(cmd);
- Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
+ Qt3DSceneEditorFactory *editor = new Qt3DSceneEditorFactory(this);
+ addAutoReleasedObject(editor);
return true;
}
@@ -91,6 +81,9 @@ 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.
+
+ // TODO: How to enable design mode properly, as this doesn't seem to work
+ //Core::DesignMode::instance()->setDesignModeIsRequired();
}
ExtensionSystem::IPlugin::ShutdownFlag Qt3DSceneEditorPlugin::aboutToShutdown()
@@ -98,17 +91,9 @@ ExtensionSystem::IPlugin::ShutdownFlag Qt3DSceneEditorPlugin::aboutToShutdown()
// Save settings
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
- return SynchronousShutdown;
-}
-void Qt3DSceneEditorPlugin::triggerAction()
-{
- // TODO: How to handle application lifecycle? Currently closing the window doesn't destroy scene
- if (!m_qmlEngine) {
- register3DSceneEditorQML();
- m_qmlEngine = new QQmlApplicationEngine(this);
- }
- m_qmlEngine->load(QUrl(QStringLiteral("qrc:/qt3deditorlib/main.qml")));
+ // TODO: Trigger save?
+ return SynchronousShutdown;
}
} // namespace Internal
diff --git a/creatorplugin/qt3dsceneeditorplugin.h b/creatorplugin/qt3dsceneeditorplugin.h
index 6aaccc8..b7719fc 100644
--- a/creatorplugin/qt3dsceneeditorplugin.h
+++ b/creatorplugin/qt3dsceneeditorplugin.h
@@ -25,6 +25,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#pragma once
#include "qt3dsceneeditor_global.h"
@@ -48,9 +49,6 @@ public:
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
-private slots:
- void triggerAction();
-
private:
QQmlApplicationEngine *m_qmlEngine;
};
diff --git a/creatorplugin/qt3dsceneeditorw.cpp b/creatorplugin/qt3dsceneeditorw.cpp
new file mode 100644
index 0000000..b059185
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditorw.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** 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 "qt3dsceneeditorw.h"
+#include "qt3dsceneeditorplugin.h"
+#include "qt3dsceneeditordocument.h"
+#include "qt3dsceneeditorconstants.h"
+#include "../editorlib/src/qt3dsceneeditor.h"
+
+#include <QQuickWidget>
+
+using namespace Utils;
+
+namespace Qt3DSceneEditor {
+namespace Internal {
+
+enum { debugQt3DSceneEditorW = 0 };
+
+Qt3DSceneEditorW::Qt3DSceneEditorW(const Core::Context &context,
+ Qt3DSceneEditorPlugin *plugin,
+ QWidget *parent)
+ : m_document(new Qt3DSceneEditorDocument(this)),
+ m_plugin(plugin),
+ m_sceneEditor(nullptr)
+{
+ Qt3DSceneEditorLib::register3DSceneEditorQML();
+ m_sceneEditor = new QQuickWidget(parent);
+ m_sceneEditor->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ m_sceneEditor->setSource(QUrl(QStringLiteral("qrc:/qt3deditorlib/PluginMain.qml")));
+
+ setContext(context);
+ setWidget(m_sceneEditor);
+
+ if (debugQt3DSceneEditorW)
+ qDebug() << __FUNCTION__;
+}
+
+Qt3DSceneEditorW::~Qt3DSceneEditorW()
+{
+ if (m_sceneEditor)
+ m_sceneEditor->deleteLater();
+}
+
+QWidget *Qt3DSceneEditorW::toolBar()
+{
+ return nullptr;
+}
+
+} // namespace Internal
+} // namespace Qt3DSceneEditor
diff --git a/creatorplugin/qt3dsceneeditorw.h b/creatorplugin/qt3dsceneeditorw.h
new file mode 100644
index 0000000..40b682e
--- /dev/null
+++ b/creatorplugin/qt3dsceneeditorw.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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 "qt3dsceneeditordocument.h"
+
+#include <coreplugin/idocument.h>
+#include <coreplugin/editormanager/ieditor.h>
+
+QT_BEGIN_NAMESPACE
+class QQuickWidget;
+QT_END_NAMESPACE
+
+namespace Qt3DSceneEditor {
+namespace Internal {
+
+class Qt3DSceneEditorPlugin;
+class Qt3DSceneEditorDocument;
+
+class Qt3DSceneEditorW : public Core::IEditor
+{
+ Q_OBJECT
+
+public:
+ Qt3DSceneEditorW(const Core::Context &context,
+ Qt3DSceneEditorPlugin *plugin,
+ QWidget *parent = 0);
+ ~Qt3DSceneEditorW() override;
+
+ // IEditor
+ Core::IDocument *document() override { return m_document; }
+ QWidget *toolBar() override;
+
+private:
+ Qt3DSceneEditorDocument *m_document;
+ Qt3DSceneEditorPlugin *m_plugin;
+ QQuickWidget *m_sceneEditor;
+};
+
+} // namespace Internal
+} // namespace Qt3DSceneEditor