aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickapplication.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2016-02-02 14:53:01 +0100
committerMitch Curtis <mitch.curtis@theqtcompany.com>2016-02-23 13:57:08 +0000
commit2b03ab642329d2498eafa35ae7159991db5791e4 (patch)
treea32cf55e5f5ef02da0ff651deb44283d62ff24d5 /src/quick/util/qquickapplication.cpp
parent72447b6dbf98ace65ec46559337243970a668d26 (diff)
Expose Qt.application.font
This is useful in order to specify font sizes that are some multiple of the default size (which is almost always guaranteed to be a sensible, legible size). For example: Text { text: "Large text" font.pixelSize: Qt.application.font.pixelSize * 2 } Other options are: - "<h3>Large text</h3>" - adds extra space below the text since it's a HTML element, so not really useful if you want a decent layout. - Hard-coding a pixel size. Works OK when used in combination with Qt::AA_EnableHighDpiScaling, and so long as you guess the correct size that works for each device/display you're targeting. Doesn't work without setting Qt::AA_EnableHighDpiScaling. - Using FontMetrics/TextMetrics. Works fine, but is a bit verbose. - Use an empty Text element. Creates an unnecessary item. Was superseded by FontMetrics/TextMetrics. - defaultPixelSize/implicitPixelSize and defaultPointSize/implicitPointSize. There are already font-related properties outside of the font grouped property, so this wouldn't be out of place, but the API is already quite large. [ChangeLog][QtQuick] Added Qt.application.font property. Change-Id: I2d0899f2a6b717aab9afcea59f42fbf3715d8406 Task-number: QTBUG-50298 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickapplication.cpp')
-rw-r--r--src/quick/util/qquickapplication.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp
index a4e2f0eb0e..5c26b23ff7 100644
--- a/src/quick/util/qquickapplication.cpp
+++ b/src/quick/util/qquickapplication.cpp
@@ -90,4 +90,9 @@ Qt::ApplicationState QQuickApplication::state() const
return QGuiApplication::applicationState();
}
+QFont QQuickApplication::font() const
+{
+ return QGuiApplication::font();
+}
+
QT_END_NAMESPACE