Plugins.qmltypes: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
qmake generates a 'qmltypes' target, that you can run. The platform shouldn't matter, as long as it is possible to load the QML import there!
qmake generates a 'qmltypes' target, that you can run. The platform shouldn't matter, as long as it is possible to load the QML import there!


Note that not all modules do work fine with qmlplugindump; In particular, crashes on exit are often seen. This does not imply though that the output is invalid.
Before dumping, please make sure that the IMPORT_VERSION set in the plugin .pro file is set correctly. This is done automatically for modules that follow the Qt minor version (like most in qtdeclarative).  


For running the command on a whole subtree (for instance inside qtdeclarative/imports), go to the build dir of qtdeclarative and execute e.g.
For running the command on a whole subtree (for instance inside qtdeclarative/imports), go to the build dir of qtdeclarative and execute e.g.


   for path in `find . -name Makefile -print`; do pushd `dirname $path`; make qmltypes; popd; done
   for path in `find . -name Makefile* -print`; do pushd `dirname $path`; make -f `basename $path` qmltypes; popd; done
 
''Note that not all modules do work fine with qmlplugindump; In particular, crashes on exit are often seen. This does not imply though that the output is invalid.''

Revision as of 12:40, 30 August 2018

This page describes the purpose of plugins.qmltypes files, and now to update them.

Purpose

plugins.qmltypes files are used to describe the API a QML Module defines as QML metadata. It's main consumer is Qt Creator, which uses it for code completion and underlining errors etc.

Qt Creator looks for the file alongside the module itself. The qmldir file of the module can link to it with 'typeinfo <filepath>'. Although the name is actually free, the default is plugins.qmltypes, and giving it a different name just causes confusion.

Aside from the use in tooling, it is also a good place to do QML API reviews!

The file can be generated by the qmlplugindump command.

File Format

TODO

Updating plugins.qmltypes

qmake generates a 'qmltypes' target, that you can run. The platform shouldn't matter, as long as it is possible to load the QML import there!

Before dumping, please make sure that the IMPORT_VERSION set in the plugin .pro file is set correctly. This is done automatically for modules that follow the Qt minor version (like most in qtdeclarative).

For running the command on a whole subtree (for instance inside qtdeclarative/imports), go to the build dir of qtdeclarative and execute e.g.

 for path in `find . -name Makefile* -print`; do pushd `dirname $path`; make -f `basename $path` qmltypes; popd; done

Note that not all modules do work fine with qmlplugindump; In particular, crashes on exit are often seen. This does not imply though that the output is invalid.