Skip to content

Commit

Permalink
Fix bundling of module for static builds
Browse files Browse the repository at this point in the history
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: I6ca9c13b7467fae069d0ec3406a0e16fbb8f59d3
Reviewed-by: Miikka Heikkinen <[email protected]>
Reviewed-by: J-P Nurmi <[email protected]>
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
Julian Strobl authored and jaheikk committed May 5, 2017
1 parent 25e5197 commit b7ded4e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/chartsqml2/chartsqml2_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ QML_DECLARE_TYPE(QScatterSeries)
QML_DECLARE_TYPE(QSplineSeries)
QML_DECLARE_TYPE(QStackedBarSeries)

static void initResources()
{
#ifdef QT_STATIC
Q_INIT_RESOURCE(qmake_QtCharts);
#endif
}

QT_CHARTS_BEGIN_NAMESPACE

class QtChartsQml2Plugin : public QQmlExtensionPlugin
Expand All @@ -148,6 +155,7 @@ class QtChartsQml2Plugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)

public:
QtChartsQml2Plugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts"));
Expand Down

0 comments on commit b7ded4e

Please sign in to comment.