[Development] qmlcachegen and QQC2 styles

Ulf Hermann ulf.hermann at qt.io
Mon May 13 10:25:44 CEST 2024


Hi,

Generally, if I read that correctly, a user would rarely need both of 
your styles. They either have a Desktop type device or a Mobile type 
device and running the other style makes little sense.

Therefore, in your case, I would propose to compile two variants of all 
your libraries: one that assumes desktop and one that assumes mobile. 
Either of those would only deal with one style. Most users would only 
install one of those variants.

On the practical side, you'd have the style to be used as a CMake 
property somewhere and you'd have a wrapper module called 
QtQuick.Controls.KDE, the only purpose of which is to import this style. 
Then, wherever you import QtQuick.Controls currently, you'd import 
QtQuick.Controls.KDE instead. From that point on, you can compile the 
two variants of all dependent libraries and applications without further 
changes.

If some user actually wants both variants installed, you can use some 
mechanism like /etc/alternatives or similar to switch between them.

Now, we could also find a fix for this on the Qt side. It would involve 
additional config files, some weaker form of whole-class FINAL and extra 
warnings from qmllint etc if you shadow properties you shouldn't shadow. 
This would be a whole lot of infrastructure, and I currently don't quite 
see who would build it. We should probably talk at Qt Contributors' 
Summit about this (and all the other proposals we've recently seen).

best regards,
Ulf


More information about the Development mailing list