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

EXT Mitch Curtis mitch.curtis at qt.io
Tue Dec 20 04:35:59 CET 2022

> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Ulf
> Hermann via Interest
> Sent: Tuesday, 20 December 2022 2:43 AM
> To: interest at qt-project.org
> Subject: Re: [Interest] Qml Linting Error - Warnings occurred while importing
> module "QtQuick.Controls":
> > Warning: QtQuick.Controls uses optional imports which are not supported.
> > Some types might not be found.
> This is not an error but a warning. Indeed the compiler will not compile your
> code to C++ because it doesn't know which of the optional imports (ie styles)
> will be active at run time. You can import one specific style, for example
> QtQuick.Controls.Fusion instead of QtQuick.Controls.
> Then the compiler will know what to expect, but you won't be able to use a
> different style at run time anymore.

As this is going to be a very common and confusing error, we should (as discussed in https://bugreports.qt.io/browse/QTBUG-108650):

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

Do we have documentation that explains how to disable warnings? It would be good to have a page with all of the warnings and how each one can be fixed.

> best regards,
> Ulf
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

More information about the Interest mailing list