diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-09-05 12:52:43 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-10-08 08:24:58 +0000 |
commit | 4a9292f16915345b5a02a43eaa244d865d9ea49c (patch) | |
tree | 72bf7951db9bc6af63a133c5a9e1fcb0f669f964 | |
parent | 24651843511aa508e5c5968eaa7c7c2d3331cc17 (diff) |
Ensure all children of a widget get updated when a stylesheet changes
Before, only the direct children would get an update when the
stylesheet changed, any children below that would be unchanged.
Fixes: QTBUG-77006
Change-Id: Id668eaae74a8289d78d66644f077e6a3302960cd
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
(cherry picked from commit 9b6179cf957c32e0c02547d510dfee2088f02340)
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 28b4c363a6..2b5db65ce2 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2732,6 +2732,11 @@ static void updateObjects(const QList<const QObject *>& objects) if (auto widget = qobject_cast<QWidget*>(const_cast<QObject*>(object))) { widget->style()->polish(widget); QApplication::sendEvent(widget, &event); + QList<const QObject *> children; + children.reserve(widget->children().size() + 1); + for (auto child: qAsConst(widget->children())) + children.append(child); + updateObjects(children); } } } |