summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-11-23 16:44:17 +0100
committerAndreas Buhr <andreas.buhr@qt.io>2020-11-24 18:54:45 +0100
commitb7d4af3586f777a436302d81d77995b46f48be68 (patch)
treeca4a59301de7bcbe2666a4c1e8cb5b4190af8ecb /src/plugins/platforms/offscreen/qoffscreenintegration.cpp
parentb051b18490be8002cdd3a007a786a07d991b8b6b (diff)
Add font function to OffscreenTheme to run unit tests with offscreen
Two unit tests fail at the moment with the offscreen theme because the font function of the offscreen theme does not return a monospace font when asked for a monospace font. This patch fixes it. Change-Id: Id682c75e2a94b246cffe97b342b1b562bac82a68 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/offscreen/qoffscreenintegration.cpp')
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index cc45776397..99a1f7fd51 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -275,6 +275,20 @@ public:
}
return QPlatformTheme::themeHint(h);
}
+
+ virtual const QFont *font(Font type = SystemFont) const override
+ {
+ static QFont systemFont(QLatin1String("Sans Serif"), 9);
+ static QFont fixedFont(QLatin1String("monospace"), 9);
+ switch (type) {
+ case QPlatformTheme::SystemFont:
+ return &systemFont;
+ case QPlatformTheme::FixedFont:
+ return &fixedFont;
+ default:
+ return nullptr;
+ }
+ }
};
QPlatformTheme *QOffscreenIntegration::createPlatformTheme(const QString &name) const