Skip to content

Commit c859273

Browse files
committed
fix(levels): use a monospace font that works on all platforms
1 parent e2a1358 commit c859273

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

friture/Levels.qml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Rectangle {
99
color: systemPalette.window
1010

1111
property var stateId
12-
property LevelViewModel level_view_model: Store.dock_states[stateId]
12+
property LevelViewModel level_view_model: Store.dock_states[stateId]
13+
14+
property var fixedFont
1315

1416
// parent here will be unset on exit
1517
height: parent ? parent.height : 0
@@ -24,7 +26,7 @@ Rectangle {
2426
id: fontMetrics
2527
font.pointSize: 14
2628
font.bold: true
27-
font.family: "monospace"
29+
font.family: fixedFont
2830
}
2931

3032
ColumnLayout {
@@ -39,7 +41,7 @@ Rectangle {
3941
text: level_view_model.two_channels ? "1: " + level_to_text(level_view_model.level_data_slow.level_max) + "<br />2: " + level_to_text(level_view_model.level_data_slow_2.level_max) : level_to_text(level_view_model.level_data_slow.level_max)
4042
font.pointSize: 14
4143
font.bold: true
42-
font.family: "monospace"
44+
font.family: fixedFont
4345
verticalAlignment: Text.AlignBottom
4446
horizontalAlignment: Text.AlignRight
4547
Layout.alignment: Qt.AlignBottom | Qt.AlignRight
@@ -62,7 +64,7 @@ Rectangle {
6264
text: level_view_model.two_channels ? "1: " + level_to_text(level_view_model.level_data_slow.level_rms) + "<br />2: " + level_to_text(level_view_model.level_data_slow_2.level_rms) : level_to_text(level_view_model.level_data_slow.level_rms)
6365
font.pointSize: 14
6466
font.bold: true
65-
font.family: "monospace"
67+
font.family: fixedFont
6668
verticalAlignment: Text.AlignBottom
6769
horizontalAlignment: Text.AlignRight
6870
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

friture/levels.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from PyQt5 import QtWidgets
2323
from PyQt5.QtQml import QQmlComponent
2424
from PyQt5.QtQuick import QQuickWindow # type: ignore
25+
from PyQt5.QtGui import QFontDatabase
2526
import numpy as np
2627

2728
from friture.store import GetStore
@@ -56,8 +57,10 @@ def __init__(self, parent, engine):
5657
component = QQmlComponent(engine, qml_url("Levels.qml"), self)
5758
raise_if_error(component)
5859

60+
fixedFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
61+
5962
engineContext = engine.rootContext()
60-
initialProperties = {"parent": self.quickWindow.contentItem(), "stateId": state_id }
63+
initialProperties = {"parent": self.quickWindow.contentItem(), "stateId": state_id, "fixedFont": fixedFont }
6164
self.qmlObject = component.createWithInitialProperties(initialProperties, engineContext)
6265
self.qmlObject.setParent(self.quickWindow)
6366

0 commit comments

Comments
 (0)