From e5f4e1405947bcecd78f15bd76162ad6b54c2502 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 12 Feb 2020 17:27:36 +0200 Subject: Examples: enable HighDPI scaling for examples on Android These examples show very tiny UI elements on Android devices, thus enabling HighDPI. Task-number: QTBUG-80717 Change-Id: I813801d5249dc1fcfc6f61a8d146f60dd19901f6 Reviewed-by: BogDan Vatra --- examples/widgets/painting/affine/main.cpp | 4 +++- examples/widgets/painting/concentriccircles/main.cpp | 3 +++ examples/widgets/painting/fontsampler/main.cpp | 3 +++ examples/widgets/painting/gradients/main.cpp | 3 +++ examples/widgets/painting/pathstroke/main.cpp | 3 +++ 5 files changed, 15 insertions(+), 1 deletion(-) (limited to 'examples/widgets/painting') diff --git a/examples/widgets/painting/affine/main.cpp b/examples/widgets/painting/affine/main.cpp index 6ce8efe482..641fc5c204 100644 --- a/examples/widgets/painting/affine/main.cpp +++ b/examples/widgets/painting/affine/main.cpp @@ -55,7 +55,9 @@ int main(int argc, char **argv) { Q_INIT_RESOURCE(affine); - +#ifdef Q_OS_ANDROID + qputenv("QT_SCALE_FACTOR", "2"); +#endif QApplication app(argc, argv); XFormWidget xformWidget(nullptr); diff --git a/examples/widgets/painting/concentriccircles/main.cpp b/examples/widgets/painting/concentriccircles/main.cpp index d9fa2879c4..00456195d9 100644 --- a/examples/widgets/painting/concentriccircles/main.cpp +++ b/examples/widgets/painting/concentriccircles/main.cpp @@ -54,6 +54,9 @@ int main(int argc, char *argv[]) { +#ifdef Q_OS_ANDROID + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif QApplication app(argc, argv); Window window; window.show(); diff --git a/examples/widgets/painting/fontsampler/main.cpp b/examples/widgets/painting/fontsampler/main.cpp index 1bf46b226f..cec6929827 100644 --- a/examples/widgets/painting/fontsampler/main.cpp +++ b/examples/widgets/painting/fontsampler/main.cpp @@ -54,6 +54,9 @@ int main(int argc, char *argv[]) { +#ifdef Q_OS_ANDROID + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif QApplication app(argc, argv); MainWindow window; window.show(); diff --git a/examples/widgets/painting/gradients/main.cpp b/examples/widgets/painting/gradients/main.cpp index 0ddf7a4579..7ffb0326e9 100644 --- a/examples/widgets/painting/gradients/main.cpp +++ b/examples/widgets/painting/gradients/main.cpp @@ -55,6 +55,9 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(gradients); +#ifdef Q_OS_ANDROID + qputenv("QT_SCALE_FACTOR", "2"); +#endif QApplication app(argc, argv); diff --git a/examples/widgets/painting/pathstroke/main.cpp b/examples/widgets/painting/pathstroke/main.cpp index 57c85d73a3..35317480a3 100644 --- a/examples/widgets/painting/pathstroke/main.cpp +++ b/examples/widgets/painting/pathstroke/main.cpp @@ -55,6 +55,9 @@ int main(int argc, char **argv) { Q_INIT_RESOURCE(pathstroke); +#ifdef Q_OS_ANDROID + qputenv("QT_SCALE_FACTOR", "2"); +#endif QApplication app(argc, argv); -- cgit v1.2.3