Improve theme information panel

- add sizing information for fonts and fontmetrics
- compute devicePixelRatio from fontmetrics

This shows that Android doesn't give us accurate information about the
default font (hence the Text items being way too small) and a wrong
Screen.devicePixelRatio, which we can actually compute ourselves.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Sebastian Kügler 2015-11-06 21:54:54 +00:00 committed by Dirk Hohndel
parent cdcb5c1603
commit 7b320a7d34

View file

@ -1,15 +1,58 @@
import QtQuick 2.5
import QtQuick.Layouts 1.1
ColumnLayout {
GridLayout {
id: themetest
columns: 2
Text {
text: "units.gridUnit is: " + units.gridUnit
Label {
Layout.columnSpan: 2
Layout.fillHeight: true
text: "Theme Information"
}
Text {
text: "units.devicePixelRatio: " + units.devicePixelRatio
FontMetrics {
id: fm
}
Label {
text: "units.gridUnit:"
}
Label {
text: units.gridUnit
}
Label {
text: "units.devicePixelRatio:"
}
Label {
text: units.devicePixelRatio
}
Label {
text: "FontMetrics pointSize:"
}
Label {
text: fm.font.pointSize
}
Label {
text: "FontMetrics pixelSize:"
}
Label {
text: fm.height
}
Label {
text: "hand-computed devicePixelRatio:"
}
Label {
text: fm.height / fm.font.pointSize
}
Item {
Layout.columnSpan: 2
Layout.fillHeight: true
}
}