See https://bugs.kde.org/show_bug.cgi?id=396287
Setting `QT_QUICK_CONTROLS_STYLE=org.kde.desktop` used to be safe but has started the cause applications to crash. Or I just never ran into what seem to be random (from a Joe User experience) but in fact are QGuiApplication-based applications.
This patch presents a proof-of-concept fix that makes it safe to set `QT_QUICK_CONTROLS_STYLE` or whatever other options there are to use the QQC2 desktop style in all applications that use QuickControls2.
The current implementation creates a local instance of Qt's built-in Fusion style, and probably doesn't need to create a new instance for each new KQuickStyleItem instance.the user's current desktop style obtained from KConfig, Being a Tier3 framework it should be possible to fetch the current desktopwith Qt's built-in Fusion style through KConfig,as fallback. in which case cCreating a new QStyle instance would be (more) justifiedis an easy way to follow changes to the user style. There's probably some optimisation to be done here though I'm not convinced it will make any difference in practice, in the general context of using QtQuick.
An alternative approach would be to do the programmatic equivalent of the command-line override (e.g. `quickcontrols2/gallery/gallery -style Default`) but I have not yet been able to figure out if it is possible to change the QQuickStyle at this point. Probably not.