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 <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-09-25 12:33:19 +02:00
parent 5480d08d15
commit a9c6b1472b

View file

@ -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 {