From 7b320a7d340bef9d12ab7bce7c5a7215023db140 Mon Sep 17 00:00:00 2001 From: Sebastian Kügler Date: Fri, 6 Nov 2015 21:54:54 +0000 Subject: Improve theme information panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 Signed-off-by: Dirk Hohndel --- qt-mobile/ThemeTest.qml | 53 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/qt-mobile/ThemeTest.qml b/qt-mobile/ThemeTest.qml index 55c15ed77..c848f1aa8 100644 --- a/qt-mobile/ThemeTest.qml +++ b/qt-mobile/ThemeTest.qml @@ -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 } } -- cgit v1.2.3-70-g09d2