path: root/src/declarative/qml/qdeclarativeimport.cpp
diff options
authorAlan Alpert <>2012-12-03 08:50:11 -0800
committerThe Qt Project <>2012-12-05 19:21:01 +0100
commit9995a2910d8a5f0317fe3adeb54f838b99ab31a8 (patch)
treed35ae22a28bed65d143e5a8920d3024c0cc164c8 /src/declarative/qml/qdeclarativeimport.cpp
parentdc96bfd00152e25f007511f64bff7c413f657886 (diff)
Add a method that allows registration of files to types
There is currently no way in C++ to duplicate the functionality of a qmldir file in mapping QML files to versioned types in a module. This functionality would be useful both in cases where a separate qmldir file would be overkill, and for cases where the type mapping should be generated dynamically. Change-Id: I28d7898122c5556fcd7cf3476795bcf4bb288eab Reviewed-by: Christopher Adams <>
Diffstat (limited to 'src/declarative/qml/qdeclarativeimport.cpp')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index db062e47..14e69728 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -518,6 +518,9 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
if (QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin))
versionFound = true;
+ //Load any type->file mappings registered for this uri
+ qmldircomponents << QDeclarativeMetaType::qmlComponents(uri.toUtf8(), vmaj, vmin);
if (!versionFound && qmldircomponents.isEmpty()) {
if (errorString) {
bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1);