From a9c6b1472b08c2c279dbad74a20bec4f3b33d1e7 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Tue, 25 Sep 2018 12:33:19 +0200 Subject: [PATCH] mobile, QML: do not user a local font metric object This theme test display created a new local FontMetrics object, that does not per definition correspond with the "global" font metric as defined in main.qml. The fix is simple. Display the font theme data based on the one and only font metric from main.qml Signed-off-by: Jan Mulder --- mobile-widgets/qml/ThemeTest.qml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mobile-widgets/qml/ThemeTest.qml b/mobile-widgets/qml/ThemeTest.qml index a5327c058..1109435ef 100644 --- a/mobile-widgets/qml/ThemeTest.qml +++ b/mobile-widgets/qml/ThemeTest.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.2 import QtQuick.Controls 2.2 as Controls import QtQuick.Window 2.2 import org.kde.kirigami 2.2 as Kirigami +import org.subsurfacedivelog.mobile 1.0 Kirigami.Page { @@ -25,9 +26,6 @@ Kirigami.Page { Layout.columnSpan: 2 level: 3 } - FontMetrics { - id: fm - } Controls.Label { text: "Geometry (pixels):" @@ -67,35 +65,35 @@ Kirigami.Page { text: "FontMetrics pointSize:" } Controls.Label { - text: fm.font.pointSize + text: fontMetrics.font.pointSize } Controls.Label { text: "FontMetrics pixelSize:" } Controls.Label { - text: Number(fm.height).toFixed(2) + text: Number(fontMetrics.height).toFixed(2) } Controls.Label { text: "FontMetrics devicePixelRatio:" } Controls.Label { - text: Number(fm.height / fm.font.pointSize).toFixed(2) + text: Number(fontMetrics.height / fontMetrics.font.pointSize).toFixed(2) } Controls.Label { text: "Text item pixelSize:" } Text { - text: font.pixelSize + text: fontMetrics.font.pixelSize } Controls.Label { text: "Text item pointSize:" } Text { - text: font.pointSize + text: fontMetrics.font.pointSize } Controls.Label { @@ -109,7 +107,7 @@ Kirigami.Page { text: "Height of default font:" } Text { - text: Number(font.pixelSize / Screen.pixelDensity).toFixed(2) + "mm" + text: Number(fontMetrics.font.pixelSize / Screen.pixelDensity).toFixed(2) + "mm" } Controls.Label {