[Interest] Qt 6.5 - The current style does not support customization of this control

EXT Mitch Curtis mitch.curtis at qt.io
Thu Apr 20 04:24:04 CEST 2023


By the way, I just checked, and Creator's qmllint integration does warn about customising native styles (in the editor itself, as annotation thingies), but only if you explicitly import the native style:

    import QtQuick.Controls.Windows

I'd imagine that less than 5% of users would actually do this, and most will instead not specify a style and just import QtQuick.Controls. In Qt 6 the default style is chosen based on your platform. With a good portion of users being on Windows, the Windows style will be chosen and they will run into this issue. qmllint relies on compile-time information, so it doesn't know about the runtime methods of setting a style [1].

So what we might need is to add some extra logic in Creator to check which style would be in use - if there's no qtquickcontrols2.conf, it could just duplicate the logic in https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quickcontrols/qquickstyle.cpp?id=239ad232d0f1e96c1c1812c5b9839fe3062f9ddc#n167, and somehow communicate with qmllint regarding this. Fabian, would it be possible to somehow allow Creator to communicate with qmllint and "override" the import checks [2]? Maybe set some environment variable that qmllint checks first?

[1] https://doc.qt.io/qt-6/qtquickcontrols-styles.html#run-time-style-selection
[2] https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/plugins/qmllint/quick/quicklintplugin.cpp?id=239ad232d0f1e96c1c1812c5b9839fe3062f9ddc#n199

> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of EXT Mitch
> Curtis via Interest
> Sent: Thursday, April 20, 2023 9:31 AM
> To: Nuno Santos <nuno.santos at imaginando.pt>; Qt Interest <interest at qt-
> project.org>
> Subject: Re: [Interest] Qt 6.5 - The current style does not support
> customization of this control
> 
> Hi,
> 
> > -----Original Message-----
> > From: Interest <interest-bounces at qt-project.org> On Behalf Of Nuno
> > Santos
> > Sent: Wednesday, April 19, 2023 5:25 PM
> > To: Qt Interest <interest at qt-project.org>
> > Subject: [Interest] Qt 6.5 - The current style does not support
> > customization of this control
> >
> > Hi,
> >
> > Yesterday I have installed Qt 6.5 to give it a try.
> >
> > I’m having a lot of this warnings on my customised version of
> > ComboBox. I have already checked the documentation and I still don’t
> > understand what are causing them
> 
> The documentations says that the Windows and macOS styles don't support
> customisation. Which style are you using? If you're not sure, you can check by
> setting the QT_LOGGING_RULES environment variable to
> qt.quick.controls.style=true.
> 
> https://bugreports.qt.io/browse/QTBUG-96733 has more background
> information on the issue if you're interested.
> 
> It would be useful if we could print the current style in the warning, but we
> can't because QQuickStyle::name() is in Qt Quick Controls, which Qt Quick
> Templates (where the warning is printed) can't use.
> 
> > qrc:/qml/UIComboBox.qml:50:17: QML Rectangle: The current style does
> > not support customization of this control (property: "background" item:
> > QQuickRectangle(0x60000383f3a0, parent=0x0, geometry=0,0 0x0)).
> Please
> > customize a non-native style (such as Basic, Fusion, Material, etc).
> > For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-
> > customize.html#customization-reference
> >
> > What am I missing?
> >
> > Thanks!
> >
> > Regards,
> >
> > Nuno
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list