Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
4.7.0
-
None
Description
QProxyStyle doesn't support being a basestyle of another QProxyStyle.
No possibility to nest QProxyStyles.
Nesting QProxyStyle is useful, one at the application level and one for some widgets.
To fix it, the main idea is to change the line in QProxyStyle.cpp:104:
baseStyle->setProxy(const_cast<QProxyStyle*>(q));
with
baseStyle->setProxy(const_cast<QStyle*>(q->proxy() ? q->proxy() : q));
There needs few more tweaks though, e.g.:
- ensureBaseStyle() always needs to call the setProxy() line even if a baseStyle exists initially.
In the following example:
A (is a QCleanlooksStyle)
B (is an application QProxyStyle that takes A as baseStyle)
C (is a widget QProxyStyle that takes B as a baseStyle)
When drawing widget X (that has a custom C style):
A.proxy = C
B.proxy = C
C.proxy = 0
When drawing widget Y (that uses the application style)
A.proxy = B
B.proxy = 0
The proxy of B needs to be cleared when C is not in use anymore.