diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-07-04 13:43:57 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-08-16 17:12:44 +0000 |
commit | ed631011faab42071f5e4fd4ea978ec0a95b4633 (patch) | |
tree | 56a9c9279d21d56092d309ea09a3ee15bb5ae979 /src/gui/text | |
parent | 1007964f2d571d5a864015846025bb35c6d79ec2 (diff) |
Rename QPlatformFontDatabase::handleAvailableFontsChanged()
The function name was easy to mistake for a function you should call
after adding fonts via e.g. registerFont or registerFontFamily, but
in reality it's meant to be used when the platform font database
knows that fonts have changed in a way that needs a full populate.
Pick-to: 6.4
Change-Id: I4a897944aaa5df891562f729440b5d98b54f61e0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/coretext/qcoretextfontdatabase.mm | 2 | ||||
-rw-r--r-- | src/gui/text/qplatformfontdatabase.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qplatformfontdatabase.h | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/text/coretext/qcoretextfontdatabase.mm b/src/gui/text/coretext/qcoretextfontdatabase.mm index d17d1bb701..70d405fc7b 100644 --- a/src/gui/text/coretext/qcoretextfontdatabase.mm +++ b/src/gui/text/coretext/qcoretextfontdatabase.mm @@ -79,7 +79,7 @@ QCoreTextFontDatabase::QCoreTextFontDatabase() #if defined(Q_OS_MACOS) m_fontSetObserver = QMacNotificationObserver(nil, NSFontSetChangedNotification, [] { qCDebug(lcQpaFonts) << "Fonts have changed"; - handleAvailableFontsChanged(); + QPlatformFontDatabase::repopulateFontDatabase(); }); #endif } diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 2b53fb0406..ce7713db03 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -618,13 +618,19 @@ void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, } /*! - Inform the Qt font database that the platform's available fonts have changed. + Requests that the platform font database should be repopulated. This will result in invalidating the entire font database. + The next time the font database is accessed it will be repopulated + via a call to QPlatformFontDatabase::populate(). + + Application fonts will not be removed, and will be automatically + populated when the font database is repopulated. + \since 6.4 */ -void QPlatformFontDatabase::handleAvailableFontsChanged() +void QPlatformFontDatabase::repopulateFontDatabase() { QFontDatabasePrivate::instance()->invalidate(); } diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index 73af0bf50f..8527e7b39c 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -103,7 +103,7 @@ public: static void registerFontFamily(const QString &familyName); static void registerAliasToFontFamily(const QString &familyName, const QString &alias); - static void handleAvailableFontsChanged(); + static void repopulateFontDatabase(); static bool isFamilyPopulated(const QString &familyName); }; |