summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlengine.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-01-07 07:33:53 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-01-07 07:33:53 (GMT)
commit78221020e2fd9370b0915a32cde81a95bdf44d87 (patch)
tree2c807d104f1e18b155de0d88d44b7749e42390a8 /src/declarative/qml/qmlengine.cpp
parent3b10e20d8230d1b6044ab5c96ffdb24bc37f85da (diff)
downloadQt-78221020e2fd9370b0915a32cde81a95bdf44d87.zip
Qt-78221020e2fd9370b0915a32cde81a95bdf44d87.tar.gz
Qt-78221020e2fd9370b0915a32cde81a95bdf44d87.tar.bz2
Load qmlmodules plugins.
This allows projects which use the declarative module to add QML types through C++ modules, such that qmlviewer (or any QML) can import those types.
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r--src/declarative/qml/qmlengine.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index d5e3884..c44f6b6 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -51,6 +51,7 @@
#include "qmlexpression.h"
#include "qmlcomponent.h"
#include "qmlmetaproperty_p.h"
+#include "qmlmoduleplugin.h"
#include "qmlbinding_p.h"
#include "qmlvme_p.h"
#include "qmlenginedebug_p.h"
@@ -88,6 +89,7 @@
#include <QGraphicsObject>
#include <QtCore/qcryptographichash.h>
+#include <private/qfactoryloader_p.h>
#include <private/qobject_p.h>
#include <private/qscriptdeclarativeclass_p.h>
@@ -1153,6 +1155,9 @@ struct QmlEnginePrivate::ImportedNamespace {
}
};
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (QmlModuleFactoryInterface_iid, QLatin1String("/qmlmodules")))
+
class QmlImportsPrivate {
public:
QmlImportsPrivate() : ref(1)
@@ -1190,6 +1195,13 @@ public:
}
}
if (!found) {
+ if (uri != QLatin1String("Qt")) { // skip well-known, it's not in a plugin
+ QFactoryLoader *l = loader();
+ QmlModuleFactoryInterface *factory =
+ qobject_cast<QmlModuleFactoryInterface*>(l->instance(uri));
+ // return value not used currently
+ }
+
// XXX assume it is a built-in type qualifier
isbuiltin = true;
}