mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-08 01:26:16 +00:00
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>
This commit is contained in:
parent
c68ac31425
commit
38307a5b3c
1 changed files with 6 additions and 11 deletions
|
@ -15,6 +15,11 @@ Kirigami.ApplicationWindow {
|
||||||
title: qsTr("Subsurface-mobile")
|
title: qsTr("Subsurface-mobile")
|
||||||
reachableModeEnabled: false // while it's a good idea, it seems to confuse more than help
|
reachableModeEnabled: false // while it's a good idea, it seems to confuse more than help
|
||||||
wideScreen: false // workaround for probably Kirigami bug. See commits.
|
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 {
|
header: Kirigami.ApplicationHeader {
|
||||||
minimumHeight: 0
|
minimumHeight: 0
|
||||||
preferredHeight: Math.round(Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1.5))
|
preferredHeight: Math.round(Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1.5))
|
||||||
|
@ -41,18 +46,8 @@ Kirigami.ApplicationWindow {
|
||||||
FontMetrics {
|
FontMetrics {
|
||||||
id: fontMetrics
|
id: fontMetrics
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("Using the following font: " + fontMetrics.font.family)
|
console.log("Using the following font: " + fontMetrics.font.family + " at " + fontMetrics.font.pointSize + "pt")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue