Remove clearWidgetPaletteHash argument from setPalette_helper

The argument is only used when the application palette is set,
(as opposed to setting the palette for a specific widget class),
and that code path is only triggered from QApplication::setPalette,
which passes 'true' for this argument.

Change-Id: I67a1cc3741f6f62653b0f95ff88d28228f9977d4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-12-20 19:09:44 +01:00
parent 2a02487ff0
commit 7b092b3fe3
2 changed files with 5 additions and 6 deletions

View File

@ -633,7 +633,7 @@ static void setPossiblePalette(const QPalette *palette, const char *className)
{ {
if (palette == 0) if (palette == 0)
return; return;
QApplicationPrivate::setPalette_helper(*palette, className, false); QApplicationPrivate::setPalette_helper(*palette, className);
} }
void QApplicationPrivate::initializeWidgetPaletteHash() void QApplicationPrivate::initializeWidgetPaletteHash()
@ -1363,7 +1363,7 @@ QPalette QApplication::palette(const char *className)
return QGuiApplication::palette(); return QGuiApplication::palette();
} }
void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash) void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className)
{ {
QPalette pal = palette; QPalette pal = palette;
@ -1380,8 +1380,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
if (!widgetPalettes.isEmpty()) { if (!widgetPalettes.isEmpty()) {
all = true; all = true;
if (clearWidgetPaletteHash) widgetPalettes.clear();
widgetPalettes.clear();
} }
} else { } else {
widgetPalettes.insert(className, pal); widgetPalettes.insert(className, pal);
@ -1416,7 +1415,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
void QApplication::setPalette(const QPalette &palette, const char* className) void QApplication::setPalette(const QPalette &palette, const char* className)
{ {
QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true); QApplicationPrivate::setPalette_helper(palette, className);
} }

View File

@ -185,7 +185,7 @@ public:
static bool widgetCount; // Coupled with -widgetcount switch static bool widgetCount; // Coupled with -widgetcount switch
static void setSystemPalette(const QPalette &pal); static void setSystemPalette(const QPalette &pal);
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); static void setPalette_helper(const QPalette &palette, const char* className);
static void initializeWidgetPaletteHash(); static void initializeWidgetPaletteHash();
static void initializeWidgetFontHash(); static void initializeWidgetFontHash();
static void setSystemFont(const QFont &font); static void setSystemFont(const QFont &font);