[Interest] Qt Quick: no qmake support anymore?

Ulf Hermann ulf.hermann at qt.io
Wed May 3 08:19:57 CEST 2023

> Which begs the question of if it's worth it to bother with QML at all, 
> or at least, when there is the option of something else like widgets. It 
> has a more complex model of mixing the two worlds, it requires 
> additional build system support, and the tooling support is also an 
> additional layer that can break more often, even for trivial examples 
> like in https://bugreports.qt.io/browse/QTCREATORBUG-24987 
> <https://bugreports.qt.io/browse/QTCREATORBUG-24987> (which BTW, has at 
> least two people saying that it isn't fixed, and I did not comment 
> myself because I stopped caring).

Well, yes, QML is a separate language that needs separate tooling and 
build system support. The very least of this is the simple "pack QML 
files into qrc" that qmake does, but even that is more than nothing. 
With widgets you can indeed write everything in C++, but because it's 
C++ it will take longer and contain uglier bugs.

QTCREATORBUG-24987 is actually a symptom of papering over the language 
barrier with sloppy heuristics. Qt Creator scans C++ code for instances 
of "qmlRegisterType" and assumes all of those are QML type registrations 
and will be available to all your QML files. Needless to say that this 
is not very accurate, and it stops working once the magic 
"qmlRegisterType" does not show up in C++ code anymore. With 
qmltyperegistrar processing QML_ELEMENT and friends we get an accurate 
way of associating C++ types with QML modules and as a result we know 
what C++ types are visible in which QML files. If each QML module is 
properly structured and placed in a QML import path, Qt Creator can 
resolve modules and types using the actual language semantics rather 
than a collection of hacks. That is, it parses the qmltypes file that 
belongs to a QML module to figure out what's in there. The CMake build 
system support allows you to easily create such well-structured modules. 
With qmake you will have a hard time.

best regards,

More information about the Interest mailing list