macOS: Reset font glyph caches when application theme changes
Our glyph caches on 10.14 are based on the application appearance, so when the application goes from dark to light or light to dark, we need to reset and re-populate the glyph-caches to account for the new appearance. Change-Id: If019d8cfa33ffb2b14747444b2ff74b288992f55 Fixes: QTBUG-71018 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
8d7542acad
commit
161c569314
@ -210,7 +210,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class Q_AUTOTEST_EXPORT QFontCache : public QObject
|
||||
class Q_GUI_EXPORT QFontCache : public QObject
|
||||
{
|
||||
public:
|
||||
// note: these static functions work on a per-thread basis
|
||||
|
@ -53,11 +53,13 @@
|
||||
#include "qcocoahelpers.h"
|
||||
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#include <QtGui/private/qfont_p.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qcoregraphics_p.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qtextformat.h>
|
||||
#include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
|
||||
#include <QtFontDatabaseSupport/private/qfontengine_coretext_p.h>
|
||||
#include <QtThemeSupport/private/qabstractfileiconengine_p.h>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
@ -162,6 +164,11 @@ void QCocoaTheme::handleSystemThemeChange()
|
||||
m_systemPalette = qt_mac_createSystemPalette();
|
||||
m_palettes = qt_mac_createRolePalettes();
|
||||
|
||||
if (QCoreTextFontEngine::fontSmoothing() == QCoreTextFontEngine::FontSmoothing::Grayscale) {
|
||||
// Re-populate glyph caches based on the new appearance's assumed text fill color
|
||||
QFontCache::instance()->clear();
|
||||
}
|
||||
|
||||
QWindowSystemInterface::handleThemeChange(nullptr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user