summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoatheme.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-12-06 14:46:26 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-12-09 23:22:14 +0000
commit161c5693143783e0364d32c587497669747efc45 (patch)
treec3c921181553cdd75e4bd879342f64f4f12635ff /src/plugins/platforms/cocoa/qcocoatheme.mm
parent8d7542acad18a2f1be701242d655015263f3147a (diff)
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>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoatheme.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index a2229159b5..240deeddbd 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -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);
}