diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-04-18 12:51:02 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-20 13:09:26 +0000 |
commit | c907d3ac1c74fcb6e084fc987c0bbfe025d78dff (patch) | |
tree | 8cb565a8102ecaa1eb97d9792366591ff1634dac | |
parent | cf4ffca3bd86e6f46440204a68d63d9526878e7c (diff) |
rogue example: Simplify font setup
Use QFont::TypeWriter style hint insted of searching all
the font families.
Task-number: QTBUG-111448
Change-Id: I14188c7b99fc0048d3f60752f1a332c8f814d278
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 5e5eacd20432c8939707a70e6c5bd9cebde76e72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | examples/statemachine/rogue/window.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/examples/statemachine/rogue/window.cpp b/examples/statemachine/rogue/window.cpp index 6dfba59..087830a 100644 --- a/examples/statemachine/rogue/window.cpp +++ b/examples/statemachine/rogue/window.cpp @@ -12,23 +12,10 @@ Window::Window() pX = 5; pY = 5; //![0] - - QFont font; - const QStringList families = QFontDatabase::families(); - if (families.contains("Monospace")) { - font = QFont(QStringList{"Monospace"}); - } - else { - for (const QString &family : families) { - if (QFontDatabase::isFixedPitch(family)) { - font = QFont(QStringList{family}); - break; - } - } - } + QFont font("Monospace"); + font.setStyleHint(QFont::TypeWriter); font.setPointSize(12); setFont(font); - //![1] setupMap(); buildMachine(); |