From 050e7bafad3b723fe5be6e981a32e708dbdc5150 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 6 May 2019 13:37:56 +1000 Subject: wasm: add fixedPitch font Also define our default font so as to return something we actually have Task-number: QTBUG-75587 Change-Id: I26e3c62921d369c3017af9796c0a20f7ac06d07c Reviewed-by: Shawn Rutledge --- src/plugins/platforms/wasm/qwasmtheme.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/plugins/platforms/wasm/qwasmtheme.cpp') diff --git a/src/plugins/platforms/wasm/qwasmtheme.cpp b/src/plugins/platforms/wasm/qwasmtheme.cpp index a7f2db3bd3..978d60d686 100644 --- a/src/plugins/platforms/wasm/qwasmtheme.cpp +++ b/src/plugins/platforms/wasm/qwasmtheme.cpp @@ -29,15 +29,22 @@ #include "qwasmtheme.h" #include +#include QT_BEGIN_NAMESPACE QWasmTheme::QWasmTheme() { + QFontDatabase fdb; + for (auto family : fdb.families()) + if (fdb.isFixedPitch(family)) + fixedFont = new QFont(family); } QWasmTheme::~QWasmTheme() { + if (fixedFont) + delete fixedFont; } QVariant QWasmTheme::themeHint(ThemeHint hint) const @@ -47,4 +54,12 @@ QVariant QWasmTheme::themeHint(ThemeHint hint) const return QPlatformTheme::themeHint(hint); } +const QFont *QWasmTheme::font(Font type) const +{ + if (type == QPlatformTheme::FixedFont) { + return fixedFont; + } + return nullptr; +} + QT_END_NAMESPACE -- cgit v1.2.3