diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-04-04 18:15:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 16:26:07 +0200 |
commit | 439a6fec84a62b9d166b84dc7574ddc250a38bfb (patch) | |
tree | 8cc00b5b3ce8f2af15bc9ba96c3cdd3987e03892 /src/plugins/platforms/android/src/opengl | |
parent | 722798a359761a1eb635d18547b076615f192508 (diff) |
Android: set logicalDpi based on DisplayMetrics.scaledDensity
The mathematically correct way would be to set logicalDPi to
160*scaledDensity, but then a 12 pt font would be gigantic. On
iOS, we use a factor of 72 to be compatible with the native APIs,
but that means that a 12 pt font is very small.
A factor of 100 means that desktop apps look reasonable by default.
Task-number: QTBUG-29674
Change-Id: I607f110150fb95685a6980b92f6f92f2b489f959
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/src/opengl')
-rw-r--r-- | src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp index cd415843a7..4734d47eb3 100644 --- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp +++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp @@ -56,6 +56,7 @@ public: EGLNativeDisplayType platformDisplay() const; QSize screenSize() const; QSizeF physicalScreenSize() const; + QDpi logicalDpi() const; int screenDepth() const; QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const; EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); @@ -86,6 +87,12 @@ QSizeF QEglFSAndroidHooks::physicalScreenSize() const return QSizeF(QAndroidPlatformIntegration::m_defaultPhysicalSizeWidth, QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight); } +QDpi QEglFSAndroidHooks::logicalDpi() const +{ + qreal lDpi = QtAndroid::scaledDensity() * 100; + return QDpi(lDpi, lDpi); +} + EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) { |