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)
This commit is contained in:
Andy Shaw 2019-09-05 12:52:43 +02:00 committed by Frederik Gladhorn
parent 2465184351
commit 4a9292f169

View File

@ -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);
}
}
}