Rename QGuiApplicationPrivate::notifyThemeChanged to handleThemeChanged

The work done by QGuiApplicationPrivate in response to a theme change
goes beyond notifying.

Change-Id: I27c74adf6549c553e659c7b8e271945ce753031c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Tor Arne Vestbø 2022-04-18 16:21:44 +02:00
parent 5907a0a944
commit fd803a6d04
4 changed files with 19 additions and 19 deletions

View File

@ -2585,13 +2585,27 @@ void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInt
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{
if (self)
self->notifyThemeChanged();
self->handleThemeChanged();
if (QWindow *window = tce->window.data()) {
QEvent e(QEvent::ThemeChange);
QGuiApplication::sendSpontaneousEvent(window, &e);
}
}
void QGuiApplicationPrivate::handleThemeChanged()
{
updatePalette();
QAbstractFileIconProviderPrivate::clearIconTypeCache();
if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
const auto locker = qt_scoped_lock(applicationFontMutex);
clearFontUnlocked();
initFontUnlocked();
}
initThemeHints();
}
void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
{
if (e->window.isNull())
@ -4198,20 +4212,6 @@ QPoint QGuiApplicationPrivate::QLastCursorPosition::toPoint() const noexcept
return thePoint.toPoint();
}
void QGuiApplicationPrivate::notifyThemeChanged()
{
updatePalette();
QAbstractFileIconProviderPrivate::clearIconTypeCache();
if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
const auto locker = qt_scoped_lock(applicationFontMutex);
clearFontUnlocked();
initFontUnlocked();
}
initThemeHints();
}
#if QT_CONFIG(draganddrop)
void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
{

View File

@ -331,7 +331,7 @@ public:
static void updatePalette();
protected:
virtual void notifyThemeChanged();
virtual void handleThemeChanged();
static bool setPalette(const QPalette &palette);
virtual QPalette basePalette() const;

View File

@ -4045,9 +4045,9 @@ void QApplicationPrivate::translateTouchCancel(const QPointingDevice *device, ul
}
}
void QApplicationPrivate::notifyThemeChanged()
void QApplicationPrivate::handleThemeChanged()
{
QGuiApplicationPrivate::notifyThemeChanged();
QGuiApplicationPrivate::handleThemeChanged();
qt_init_tooltip_palette();
}

View File

@ -165,7 +165,7 @@ public:
static QStyle *app_style;
protected:
void notifyThemeChanged() override;
void handleThemeChanged() override;
QPalette basePalette() const override;
void handlePaletteChanged(const char *className = nullptr) override;