Utils: Fix the applying of new base color at run-time

If the base color was changed via the color picker that opens with
shift-click on the upper left toolbar area, some widgets were not
instantly updated with the new color.

This change ensures that all (visible) widgets instead of just all top
level windows get updated after changing the color. While this method is
potentially more expensive, it does not effect the start-up negatively,
because on start-up StyleHelper::setBaseColor() gets called before the
mainwindow is shown.

Fixes: QTCREATORBUG-29135
Change-Id: I227c2f243ffcd9f8210b9d2d1a47ad0494663d50
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2023-05-09 17:38:23 +02:00
parent 5975657e77
commit e44d0c57dc

View File

@@ -190,7 +190,7 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
if (color.isValid() && color != m_baseColor) {
m_baseColor = color;
const QList<QWidget *> widgets = QApplication::topLevelWidgets();
const QWidgetList widgets = QApplication::allWidgets();
for (QWidget *w : widgets)
w->update();
}