summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2013-06-25 19:12:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-05 17:29:18 +0200
commit691cb20d95357cdaa7d158a3c26f3ca66cdbe537 (patch)
treef84cb5cab52f036325c5da48d6b9cc486dbb8e39 /src/plugins/platforms/cocoa/qcocoasystemsettings.mm
parentea7da7c241c7334305f256102d767bf3904370bd (diff)
Add API to let applications integrate with the system fonts
This patch does 2 things mainly: - Adds a QPlatformTheme font type for fixed fonts. It's important because some OS provide specific monospaced fonts and we want to let our applications to use the preferred fonts by default. - Adds a new method and enum to QFontDatabase that expose the font types that applications might need, so that they can make the applications use the specific fonts that the system recommends. This data was already available within Qt through the QPlatformTheme, but it was not possible to use this data by Qt users. This new method exposes such data. Change-Id: Ic194c1e4bc07a70640672afd82ba756b87606985 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoasystemsettings.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemsettings.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
index af817bd4c5..194394d11a 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
@@ -264,6 +264,10 @@ QHash<QPlatformTheme::Font, QFont *> qt_mac_createRoleFonts()
fonts.insert(QPlatformTheme::SmallFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont));
fonts.insert(QPlatformTheme::MiniFont, qt_mac_qfontForThemeFont(kThemeMiniSystemFont));
+ QFont* fixedFont = new QFont(QStringLiteral("Monaco"), fonts[QPlatformTheme::SystemFont]->pointSize());
+ fixedFont->setStyleHint(QFont::TypeWriter);
+ fonts.insert(QPlatformTheme::FixedFont, fixedFont);
+
return fonts;
}