summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-06-19 10:00:13 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-07-05 17:36:04 +0200
commitc4f1b0f7c477e87bc2bee3611807cbdf7b5f8ec4 (patch)
tree8d026197c0433a4a0d1532c858e22b45389516d5 /src/widgets
parent550e511ec8a1aa12ac75ebd71079511572840065 (diff)
Repolish child widgets when parent style sheet changes
If a child widget that is affected by the parent's style sheet is polished (because it's been shown explicitly, for instance by a layout), then it must be repolished when the parent's style sheet changes, even if the parent itself has not been polished yet. Since the style sheet is set on the parent widget, we must repolish the parent (which will repolish the entire widget tree), not just the individual children and grand children. Fixes: QTBUG-76945 Task-number: QTBUG-39427 Task-number: QTBUG-18958 Change-Id: I7bca9ee1badc07202fa05dc97f440f4ca6c9517d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidget.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index a5ad101201..95d38c4882 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2575,7 +2575,16 @@ void QWidget::setStyleSheet(const QString& styleSheet)
}
if (proxy) { // style sheet update
- if (d->polished)
+ bool repolish = d->polished;
+ if (!repolish) {
+ const auto childWidgets = findChildren<QWidget*>();
+ for (auto child : childWidgets) {
+ repolish = child->d_func()->polished;
+ if (repolish)
+ break;
+ }
+ }
+ if (repolish)
proxy->repolish(this);
return;
}