summaryrefslogtreecommitdiffstats
path: root/src/quick3d/imports/scene2d
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2017-01-20 14:27:08 +0200
committerAntti Määttä <antti.maatta@qt.io>2017-02-28 09:48:17 +0000
commit154c3a9b44082a176a9700b5086a7bc758155a25 (patch)
tree0a95efa2fcfe715a861602d0be9dce0d226c6ff1 /src/quick3d/imports/scene2d
parent0bb720013d93c34d589c352a53405d8110fa57fe (diff)
Move scene2d to own module and implement conditional plugin loading
- Add quick3dscene2d module - Add importsscene2d qml module - Modify RenderAspect to load plugins conditionally - change autotests to match the module change Change-Id: If6596472acbd9a377561b2bfd2094a0585c781ac Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/quick3d/imports/scene2d')
-rw-r--r--src/quick3d/imports/scene2d/importsscene2d.pro19
-rw-r--r--src/quick3d/imports/scene2d/qmldir3
-rw-r--r--src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp56
-rw-r--r--src/quick3d/imports/scene2d/qtquickscene2dplugin.h62
4 files changed, 140 insertions, 0 deletions
diff --git a/src/quick3d/imports/scene2d/importsscene2d.pro b/src/quick3d/imports/scene2d/importsscene2d.pro
new file mode 100644
index 000000000..13ccf7818
--- /dev/null
+++ b/src/quick3d/imports/scene2d/importsscene2d.pro
@@ -0,0 +1,19 @@
+CXX_MODULE = qml
+TARGET = qtquickscene2dplugin
+TARGETPATH = QtQuick/Scene2D
+IMPORT_VERSION = 2.0
+
+QT += qml quick 3dcore 3drender 3drender-private 3dinput 3dlogic 3dquickscene2d
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
+HEADERS += \
+ qtquickscene2dplugin.h \
+
+SOURCES += \
+ qtquickscene2dplugin.cpp \
+
+OTHER_FILES += qmldir
+
+load(qml_plugin)
diff --git a/src/quick3d/imports/scene2d/qmldir b/src/quick3d/imports/scene2d/qmldir
new file mode 100644
index 000000000..2e807f1e6
--- /dev/null
+++ b/src/quick3d/imports/scene2d/qmldir
@@ -0,0 +1,3 @@
+module QtQuick.Scene2D
+plugin qtquickscene2dplugin
+classname QtQuickScene2DPlugin
diff --git a/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp b/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp
new file mode 100644
index 000000000..44ca596d3
--- /dev/null
+++ b/src/quick3d/imports/scene2d/qtquickscene2dplugin.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtquickscene2dplugin.h"
+
+#include <Qt3DQuickScene2D/qscene2d.h>
+#include <private/qrenderaspect_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static void initScene2dPlugin()
+{
+ Qt3DRender::QRenderAspectPrivate::configurePlugin("scene2d");
+}
+
+Q_COREAPP_STARTUP_FUNCTION(initScene2dPlugin)
+
+void QtQuickScene2DPlugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<Qt3DRender::Quick::QScene2D>(uri, 2, 9, "Scene2D");
+}
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene2d/qtquickscene2dplugin.h b/src/quick3d/imports/scene2d/qtquickscene2dplugin.h
new file mode 100644
index 000000000..c9318673f
--- /dev/null
+++ b/src/quick3d/imports/scene2d/qtquickscene2dplugin.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKSCENE2DPLUGIN_H
+#define QTQUICKSCENE2DPLUGIN_H
+
+#include <QtQml/qqmlextensionplugin.h>
+
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Scene2D);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickScene2DPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+public:
+ QtQuickScene2DPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
+ void registerTypes(const char *uri) Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKSCENE2DPLUGIN_H