From 61c3f3539c3d2d7dc867c3fef0270a2f5c9ed376 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Wed, 28 Mar 2018 18:24:22 +0100 Subject: Make QStyle::proxy() always return the leaf proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/widgets/styles/qstyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets/styles/qstyle.cpp') diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index c839afd639..8aa423c224 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -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; } -- cgit v1.2.3