From 9995a2910d8a5f0317fe3adeb54f838b99ab31a8 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 3 Dec 2012 08:50:11 -0800 Subject: 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 --- doc/src/declarative/qtdeclarative.qdoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'doc') 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 to use this function. + + Returns non-zero if the registration was sucessful. +*/ -- cgit v1.2.3