diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-09-22 15:57:02 -0700 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-09-25 15:58:17 +0200 |
commit | 38307a5b3c7bfd798815d18d7b2b982075ec8e12 (patch) | |
tree | 6722787e828e85d0426e859f18da375aebe7dc47 | |
parent | c68ac31425d18d01468aac31fecf098bedc40e51 (diff) | |
download | subsurface-38307a5b3c7bfd798815d18d7b2b982075ec8e12.tar.gz |
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 <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/main.qml | 17 |
1 files changed, 6 insertions, 11 deletions
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 |