[Interest] K'fusion, or descending Fusion from KStyle

René J.V. Bertin rjvbertin at gmail.com
Wed Sep 18 11:28:27 CEST 2019


[resent in adapted form from the plasma-devel ML in hope of getting a reply here]

Hi,

I had a recent run-in with a style hint that should actually be a platform (QPA) specific property (à la AA_DontUseNativeMenuBar; see QTBUG-77928) and then realised it could be useful to have a standalone Fusion override style that inherits the KF5 KStyle wrapper class which can handle this kind of situation.
Experience with the "native" Mac style suggests that Qt will give precedence to styles provided by plugins over styles provided in libQt5Widgets, so overriding a built-in style should indeed be possible.

KStyle inheritance was introduced in the QtCurve style with a simple `using` construct: when built with KDE support the style class will inherit KStyle, else it will inherit QCommonStyle.

It turns out that the Fusion style class invokes a protected QCommonStyle ctor that takes a newly allocated instance of the associated private class; KStyle itself inherits QCommonStyle but not this method.

What are the options here, short of extending KStyle and/or using a "hand-written" d-pointer in the standalone Fusion style class? I tried `d_ptr.reset(new PrivateFoo)` but that leads to a runtime error about reparenting an instance with a parent from a different thread followed by a crash.

Thanks,
R.



More information about the Interest mailing list