path: root/doc
diff options
authorAlan Alpert <>2012-12-03 08:50:11 -0800
committerThe Qt Project <>2012-12-05 19:21:01 +0100
commit9995a2910d8a5f0317fe3adeb54f838b99ab31a8 (patch)
treed35ae22a28bed65d143e5a8920d3024c0cc164c8 /doc
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 'doc')
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 5b43c9a3..0c195a8e 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -211,3 +211,18 @@
Returns the QML type id.
+ \fn int qmlRegisterType(const char *url, const char *uri, int versionMajor, int versionMinor, const char *qmlName);
+ \relates QDeclarativeEngine
+ This function registers a type in the QML system with the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor. The type is defined by the QML file located at \a url.
+ Normally QML files can be loaded as types directly from other QML files, or using a qmldir file. This function allows
+ registration of files to types from a C++ module, such as when the type mapping needs to be procedurally determined at startup.
+ #include <QtDeclarative> to use this function.
+ Returns non-zero if the registration was sucessful.