aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@theqtcompany.com>2015-12-18 13:54:42 +0100
committerAndy Shaw <andy.shaw@theqtcompany.com>2015-12-21 09:47:44 +0000
commit58aa1bcb385871db05b47933332872d2aec15311 (patch)
tree322f6e342d13052212fe96c943faa583fce72dca
parent6148c9c0f213478d12fb67b04de102666b8c0c05 (diff)
Enable using the module in a statically built application
In order to make this possible the qml files need to be pulled into a plugin when statically built so a plugin is set up for the effects directory. This will effectively just be a stub in the dynamically built case. Change-Id: I421aa4972fe1923f10317515ee6c1df0fd69edda Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/effects/effects_plugin.pro10
-rw-r--r--src/effects/plugin.cpp63
-rw-r--r--src/effects/private/plugin.cpp10
-rw-r--r--src/effects/private/qmldir2
-rw-r--r--src/effects/qmldir4
5 files changed, 84 insertions, 5 deletions
diff --git a/src/effects/effects_plugin.pro b/src/effects/effects_plugin.pro
index 3494d17..82735d8 100644
--- a/src/effects/effects_plugin.pro
+++ b/src/effects/effects_plugin.pro
@@ -1,5 +1,8 @@
-TARGETPATH = "QtGraphicalEffects"
-
+CXX_MODULE = qml
+TARGET = qtgraphicaleffectsplugin
+TARGETPATH = QtGraphicalEffects
+QT += quick qml
+IMPORT_VERSION = 1.0
QML_FILES = \
Blend.qml \
BrightnessContrast.qml \
@@ -28,4 +31,5 @@ QML_FILES = \
ZoomBlur.qml \
QMAKE_DOCS = $$PWD/doc/qtgraphicaleffects.qdocconf
-load(qml_module)
+SOURCES += plugin.cpp
+load(qml_plugin)
diff --git a/src/effects/plugin.cpp b/src/effects/plugin.cpp
new file mode 100644
index 0000000..c0f600a
--- /dev/null
+++ b/src/effects/plugin.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Graphical Effects module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlengine.h>
+
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtGraphicalEffects);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtGraphicalEffectsPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ QtGraphicalEffectsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtGraphicalEffects"));
+ Q_UNUSED(uri);
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/src/effects/private/plugin.cpp b/src/effects/private/plugin.cpp
index 9fd9ca2..7d86c2e 100644
--- a/src/effects/private/plugin.cpp
+++ b/src/effects/private/plugin.cpp
@@ -38,6 +38,13 @@
#include "qgfxsourceproxy_p.h"
#include "qgfxshaderbuilder_p.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtGraphicalEffects_private);
+#endif
+}
+
QT_BEGIN_NAMESPACE
static QObject *qgfxshaderbuilder_provider(QQmlEngine *, QJSEngine *)
@@ -45,12 +52,13 @@ static QObject *qgfxshaderbuilder_provider(QQmlEngine *, QJSEngine *)
return new QGfxShaderBuilder();
}
-class QtGraphicalEffectsPlugin : public QQmlExtensionPlugin
+class QtGraphicalEffectsPrivatePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
+ QtGraphicalEffectsPrivatePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QByteArray(uri) == QByteArrayLiteral("QtGraphicalEffects.private"));
diff --git a/src/effects/private/qmldir b/src/effects/private/qmldir
index 93e78c7..2d4bdac 100644
--- a/src/effects/private/qmldir
+++ b/src/effects/private/qmldir
@@ -1,6 +1,6 @@
module QtGraphicalEffects.private
plugin qtgraphicaleffectsprivate
-classname QtGraphicalEffectsPlugin
+classname QtGraphicalEffectsPrivatePlugin
FastGlow 1.0 FastGlow.qml
FastInnerShadow 1.0 FastInnerShadow.qml
FastMaskedBlur 1.0 FastMaskedBlur.qml
diff --git a/src/effects/qmldir b/src/effects/qmldir
index 6a78b6b..f5012e4 100644
--- a/src/effects/qmldir
+++ b/src/effects/qmldir
@@ -1,3 +1,6 @@
+module QtGraphicalEffects
+plugin qtgraphicaleffectsplugin
+classname QtGraphicalEffectsPlugin
Blend 1.0 Blend.qml
BrightnessContrast 1.0 BrightnessContrast.qml
Colorize 1.0 Colorize.qml
@@ -24,4 +27,5 @@ RectangularGlow 1.0 RectangularGlow.qml
ThresholdMask 1.0 ThresholdMask.qml
ZoomBlur 1.0 ZoomBlur.qml
designersupported
+depends QtGraphicalEffects/private 1.0