From 659d5202f915b84bd22b618b0696bbe68ab4b6b0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 Jan 2017 20:09:23 +0100 Subject: Add fontInfo property to Text This provides a way to determine which font will actually be used to presenting the text, which can be especially useful when not using a fixed size font (the font info will then expose the actual font size used by the Text element.) [ChangeLog][QtQuick][Text] Added fontInfo property to Text type, providing a way to query properties of the actual font used for presenting the text. Task-number: QTBUG-51133 Change-Id: I5860fb1bd25ac5734713f49c8482428f2d531d22 Reviewed-by: Simon Hausmann Reviewed-by: Robin Burchell --- tests/auto/quick/qquicktext/data/fontInfo.qml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/auto/quick/qquicktext/data/fontInfo.qml (limited to 'tests/auto/quick/qquicktext/data') diff --git a/tests/auto/quick/qquicktext/data/fontInfo.qml b/tests/auto/quick/qquicktext/data/fontInfo.qml new file mode 100644 index 0000000000..25f924029f --- /dev/null +++ b/tests/auto/quick/qquicktext/data/fontInfo.qml @@ -0,0 +1,24 @@ +import QtQuick 2.9 + +Item { + Text { + id: main + objectName: "main" + width: 500 + height: 500 + text: "Meaningless text" + font.pixelSize: 1000 + fontSizeMode: Text.Fit + } + + Text { + objectName: "copy" + text: main.text + width: main.width + height: main.height + + font.family: main.fontInfo.family + font.pixelSize: main.fontInfo.pixelSize + } +} + -- cgit v1.2.3