Simplify QApplication::palette

Change-Id: I1f1be554a72a385985eeee0b79b49acdfcf40d8e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-12-19 12:28:33 +01:00
parent fe784abc80
commit c7ecff0460

View File

@ -1354,15 +1354,14 @@ QPalette QApplication::palette(const QWidget* w)
*/ */
QPalette QApplication::palette(const char *className) QPalette QApplication::palette(const char *className)
{ {
if (!QApplicationPrivate::app_pal)
palette();
PaletteHash *hash = app_palettes(); PaletteHash *hash = app_palettes();
if (className && hash && hash->size()) { if (className && hash && hash->size()) {
QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className); QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className);
if (it != hash->constEnd()) if (it != hash->constEnd())
return *it; return *it;
} }
return *QApplicationPrivate::app_pal;
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, bool clearWidgetPaletteHash)