From 439a6fec84a62b9d166b84dc7574ddc250a38bfb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 4 Apr 2013 18:15:00 +0200 Subject: 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 --- src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp') 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) { -- cgit v1.2.3