-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
4.6.3, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 5.0.0
-
None
-
Windows, Linux, Mac
QProxyStyle::ensureBaseStyle() should always reset the proxy of its base style.
Here is an example why:
QProxyStyle* proxyWidgetA = new QProxyStyle(base);
proxyWidgetA->standardPalette(); // call QProxyStyle::ensureBaseStyle()
Q_ASSERT(base->proxy() == proxyWidgetA);
QProxyStyle* proxyWidgetB = new QProxyStyle(base);
proxyWidgetB->standardPalette(); // QProxyStyle::ensureBaseStyle()
Q_ASSERT(base->proxy() == proxyWidgetB);
// When the widget A is drawn...
proxyWidgetA->standardPalette(); // QProxyStyle::ensureBaseStyle()
Q_ASSERT(base->proxy() == proxyWidgetA); // -> fail
Please also note that QProxyStyle::QProxyStyle() QProxyStyle::setBaseStyle() and QProxyStyle::ensureBaseStyle() could benefit from refactorization. (calls to setProxy(...) and setParent(...) are duplicated). Worst, QProxyStyle::QProxyStyle(QStyle* s) creates an unnecessary style because of the order of the calls (in constructor, setParent() triggers a ensureBaseStyle() that creates a system style)