Skip to content

Commit

Permalink
Merge pull request #4555 from uklotzde/qt6-qfontdatabase
Browse files Browse the repository at this point in the history
Qt6: Use static functions in QFontDatabase
  • Loading branch information
Holzhaus authored Dec 6, 2021
2 parents 2fe7f92 + 4abca56 commit e34ef4a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/util/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,22 @@ class FontUtils {
// In developer mode, spit out all the families / styles / sizes
// supported by the new font.
if (CmdlineArgs::Instance().getDeveloper()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QFontDatabase database;
#endif
QStringList families = QFontDatabase::applicationFontFamilies(result);
foreach (const QString& family, families) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringList styles = QFontDatabase::styles(family);
#else
QStringList styles = database.styles(family);
#endif
foreach (const QString& style, styles) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<int> pointSizes = QFontDatabase::pointSizes(family, style);
#else
QList<int> pointSizes = database.pointSizes(family, style);
#endif
QStringList pointSizesStr;
foreach (int point, pointSizes) {
pointSizesStr.append(QString::number(point));
Expand Down

0 comments on commit e34ef4a

Please sign in to comment.