[Interest] Qml Linting Error - Warnings occurred while importing module "QtQuick.Controls":

Ulf Hermann ulf.hermann at qt.io
Tue Dec 20 09:11:17 CET 2022

> - Have an option to disable the warning for those who want to support multiple styles in one executable (but still want compilation outside of controls). You said it is possible to "disable the compilation for this specific file", but I'm not sure if that's the same thing as disabling the warning for the whole codebase, which would be preferable.

As described in https://doc.qt.io/qt-6/qt-add-qml-module.html you can 
turn the compilation to C++ off per target with the --only-bytecode 
option to qmlsc or qmlcachegen. qmltc and qmllint are opt-in anyway.

> - Add instructions to the warning that mention how to fix it if they're OK with only supporting one style, or disable it.

The message is a generic warning you will get for any optional imports, 
not only for QtQuick.Controls. If you don't like to see this warning, 
you can turn it off in most cases:

* qmllint currently has no way to output this warning.

* qmlcachegen is silent by default and suppresses all warnings.

* qmlsc outputs warnings, and also this one, by default, but you can 
just turn off the qt.qml.compiler.aot logging category if you want it to 
be silent.

* qmltc will fail on any missing type information, including this one. 
That's unavoidable. It cannot create a sensible C++ object structure if 
some part of it is invisible.

More information about the Interest mailing list