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

For example:

  fusion -> proxy1 -> proxy2

Now returns proxy2.

Fixes: QTBUG-85556
Change-Id: I2a60329f948b59ef7d0752d273bee3854a200547
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 61c3f3539c3d2d7dc867c3fef0270a2f5c9ed376)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Sergio Martins 2018-03-28 18:24:22 +01:00 committed by Qt Cherry-pick Bot
parent 7d0cbfc257
commit 1580c84e1a

View File

@ -2401,17 +2401,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;
}