Make QStyle::proxy() always return the leaf proxy

For example:

  fusion -> proxy1 -> proxy2

Now returns proxy2.

Fixes: QTBUG-85556
Pick-to: 6.0 5.15
Change-Id: I2a60329f948b59ef7d0752d273bee3854a200547
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Sergio Martins 2018-03-28 18:24:22 +01:00 committed by Tor Arne Vestbø
parent fb51b4732c
commit 61c3f3539c

View File

@ -2430,17 +2430,19 @@ int QStyle::combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
const QStyle * QStyle::proxy() const
{
Q_D(const QStyle);
return d->proxyStyle;
return d->proxyStyle == this ? this : d->proxyStyle->proxy();
}
/* \internal
This function sets the base style that style calls will be
redirected to. Note that ownership is not transferred.
redirected to. Note that ownership is not transferred. \a style
must be a valid pointer (not nullptr).
*/
void QStyle::setProxy(QStyle *style)
{
Q_D(QStyle);
Q_ASSERT(style);
d->proxyStyle = style;
}