[PATCH 09/11] Improve theme information panel

Sebastian Kügler sebas at kde.org
Fri Nov 6 13:54:54 PST 2015


- 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 at kde.org>
---
 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 55c15ed..c848f1a 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
 	}
 }
-- 
2.6.2



More information about the subsurface mailing list