winrt: Return monospace font for QFontDatabase::systemFont(QFontDatabase::FixedFont)

Fixes: QTBUG-75648
Change-Id: I0e5e5e012d3cd5985d1e9a63e776e73ce2d7bf98
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Oliver Wolff 2019-05-15 10:40:12 +02:00 committed by Shawn Rutledge
parent f4976f86cd
commit 3b380c8481
3 changed files with 19 additions and 1 deletions

View File

@ -44,6 +44,8 @@
#include <QtCore/qfunctions_winrt.h>
#include <QtGui/QPalette>
#include <QtFontDatabaseSupport/private/qwinrtfontdatabase_p.h>
#include <wrl.h>
#include <windows.ui.h>
#include <windows.ui.viewmanagement.h>
@ -96,7 +98,13 @@ static IUISettings *uiSettings()
class QWinRTThemePrivate
{
public:
QWinRTThemePrivate()
: monospaceFont(QWinRTFontDatabase::familyForStyleHint(QFont::Monospace))
{
}
QPalette palette;
QFont monospaceFont;
};
static inline QColor fromColor(const Color &color)
@ -321,4 +329,14 @@ const QPalette *QWinRTTheme::palette(Palette type) const
return QPlatformTheme::palette(type);
}
const QFont *QWinRTTheme::font(QPlatformTheme::Font type) const
{
Q_D(const QWinRTTheme);
qCDebug(lcQpaTheme) << __FUNCTION__ << type;
if (type == QPlatformTheme::FixedFont)
return &d->monospaceFont;
return QPlatformTheme::font(type);
}
QT_END_NAMESPACE

View File

@ -58,6 +58,7 @@ public:
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
const QPalette *palette(Palette type = SystemPalette) const override;
const QFont *font(Font type = SystemFont) const override;
static QVariant styleHint(QPlatformIntegration::StyleHint hint);
QVariant themeHint(ThemeHint hint) const override;

View File

@ -1,3 +1,2 @@
[systemFixedFont] # QTBUG-54623
winrt
b2qt