aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Strobl <stroblju@gmail.com>2017-05-03 18:37:39 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2017-05-05 04:50:39 +0000
commit4d13d69645062b009d026b1f3777c1f7512f59d3 (patch)
tree6f251344d3c9961c214a0a5f5578297d98083866
parent015add9d0887601845787d60ce1d6af635861b23 (diff)
Fix bundling of module for static builds
Without this patch the module is not bundled in static builds correctly causing 'module "<QtModule>" is not installed' errors in during runtime. As reference: this happens, because 'QQmlMetaType::isAnyModule(importUri)' at 'qtdeclarative/src/qml/qml/qqmltypeloader.cpp:1422:' returns 'false', which indicates that the module was not registered. Task-number: QTBUG-59559 Change-Id: I7c517ec22b4e3cad11bc961a76473111c2731823 Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r--src/imports/gamepad/qtgamepad.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/imports/gamepad/qtgamepad.cpp b/src/imports/gamepad/qtgamepad.cpp
index 7ecee2d..3b81dec 100644
--- a/src/imports/gamepad/qtgamepad.cpp
+++ b/src/imports/gamepad/qtgamepad.cpp
@@ -43,6 +43,13 @@
#include "qgamepadmouseitem.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtGamepad);
+#endif
+}
+
QT_BEGIN_NAMESPACE
static QObject *gamepadmanager_singletontype_provider(QQmlEngine * /* engine */, QJSEngine * /* scriptEngine */)
@@ -57,6 +64,7 @@ class QGamepadModule : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
+ QGamepadModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtGamepad"));