diff options
author | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-07-09 16:32:44 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-10-26 09:27:54 +0000 |
commit | b2d24dc3475906d4f46c917f129fd98e883569a6 (patch) | |
tree | 02a950fd2bbac1663f106ec932a596233cddb6ac /src/plugins/platforms/android/qandroidplatformscreen.h | |
parent | 45bb9c29e8b70cd15b01d8ab18d1df7f9707c215 (diff) |
Android: Add opt-in high-dpi support
Opt-in by setting android.app.auto_screen_scale_factor
to true in AndroidManifest.xml. This will enable
devicePixelRatio scaling in QtGui using a scale
factor provided by Android DisplayMetrics.
Note that the Android style is not currently supported:
it already accounts for different display densities
which results in incorrect visual sizes when enabling
devicePixelRatio scaling.
Implementation: Bring DisplayMetrics::density through
to setDisplayMetrics in androidjnimain.cpp, similar
to what is done for "scaledDensity". Override
QPlatformScreen::pixelDensity(), which forwards the
scale factor to QtGui.
[The difference between "density" and "scaledDensity"
is that the former is a physical display density factor
which corresponds closely to devicePixelRatio in Qt,
while the latter also includes the Android global font
scale factor.]
Scale the global font pixel size in qandroidplatformtheme.cpp
to keep the visual font size constant.
Based on an initial patch from Daiwei Li <daiweili@suitabletech.com>
Task-number: QTBUG-46615
Change-Id: Ia51f99bf6dda485a57413949246c7b32cb47e8dd
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformscreen.h')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h index 403d6036f0..c01dbbc712 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.h +++ b/src/plugins/platforms/android/qandroidplatformscreen.h @@ -96,6 +96,7 @@ protected: private: QDpi logicalDpi() const; + qreal pixelDensity() const; Qt::ScreenOrientation orientation() const; Qt::ScreenOrientation nativeOrientation() const; void surfaceChanged(JNIEnv *env, jobject surface, int w, int h); |