diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-04-18 12:51:02 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-04-20 11:00:18 +0200 |
commit | 5e5eacd20432c8939707a70e6c5bd9cebde76e72 (patch) | |
tree | 1b9d375030c380533724f4257ed18a8e92f4b200 | |
parent | 144e9f1251d0a9acddc5528fd7aaec0b6b1bbf39 (diff) |
rogue example: Simplify font setup
Use QFont::TypeWriter style hint insted of searching all
the font families.
Task-number: QTBUG-111448
Pick-to: 6.5
Change-Id: I14188c7b99fc0048d3f60752f1a332c8f814d278
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
-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(); |