Skip to content

Commit

Permalink
Ensure all children of a widget get updated when a stylesheet changes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AndyShawQt committed Sep 20, 2019
1 parent b8a911f commit 9b6179c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/widgets/styles/qstylesheetstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,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);
}
}
}
Expand Down

0 comments on commit 9b6179c

Please sign in to comment.