From 38307a5b3c7bfd798815d18d7b2b982075ec8e12 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 22 Sep 2018 15:57:02 -0700 Subject: QML UI: ensure we use the correct default font It seems the documentation is incorrect - unless you explicitly set the ApplicationWindow font to the the Application Font (just writing this down sounds so silly...), it doesn't actually work. Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index b20ff4d2b..3c6fdc02d 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -15,6 +15,11 @@ Kirigami.ApplicationWindow { title: qsTr("Subsurface-mobile") reachableModeEnabled: false // while it's a good idea, it seems to confuse more than help wideScreen: false // workaround for probably Kirigami bug. See commits. + + // the documentation claims that the ApplicationWindow should pick up the font set on + // the C++ side. But as a matter of fact, it doesn't, unless you add this line: + font: Qt.application.font + header: Kirigami.ApplicationHeader { minimumHeight: 0 preferredHeight: Math.round(Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1.5)) @@ -41,18 +46,8 @@ Kirigami.ApplicationWindow { FontMetrics { id: fontMetrics Component.onCompleted: { - console.log("Using the following font: " + fontMetrics.font.family) - } - - /* this shouldn't be needed anymore - Component.onCompleted: { - if (Math.round(rootItem.width / Kirigami.Units.gridUnit) < 20) { - fontMetrics.font.pointSize = fontMetrics.font.pointSize * 2 / 3 - Kirigami.Theme.defaultFont.pointSize = fontMetrics.font.pointSize - console.log("Reduce font size for narrow screens: " + fontMetrics.font.pointSize) - } + console.log("Using the following font: " + fontMetrics.font.family + " at " + fontMetrics.font.pointSize + "pt") } - */ } visible: false -- cgit v1.2.3-70-g09d2