|author||Alan Alpert <firstname.lastname@example.org>||2012-12-03 08:50:11 -0800|
|committer||The Qt Project <email@example.com>||2012-12-05 19:21:01 +0100|
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 <firstname.lastname@example.org>
Diffstat (limited to 'doc/src/declarative/qtdeclarative.qdoc')
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
@@ -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.