summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index d81632cfbe2..cddf5833fa0 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -161,6 +161,7 @@ QWidgetPrivate::QWidgetPrivate(decltype(QObjectPrivateVersion) version)
, childrenHiddenByWState(0)
, childrenShownByExpose(0)
, dontSetExplicitShowHide(0)
+ , inheritStyleRecursionGuard(0)
#if defined(Q_OS_WIN)
, noPaintOnScreen(0)
#endif
@@ -2692,7 +2693,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate)
extra->style = newStyle;
// repolish
- if (polished && q->windowType() != Qt::Desktop && oldStyle != q->style()) {
+ if (polished && q->windowType() != Qt::Desktop) {
oldStyle->unpolish(q);
q->style()->polish(q);
}
@@ -2740,6 +2741,12 @@ void QWidgetPrivate::inheritStyle()
proxy->repolish(q);
return;
}
+ if (inheritStyleRecursionGuard)
+ return;
+ inheritStyleRecursionGuard = true;
+ const auto resetGuard = qScopeGuard([&]() {
+ inheritStyleRecursionGuard = false;
+ });
QStyle *origStyle = proxy ? proxy->base : extraStyle;
QWidget *parent = q->parentWidget();