diff --git a/src/android/jar/src/org/qtproject/qt/android/QtLayout.java b/src/android/jar/src/org/qtproject/qt/android/QtLayout.java index 98d3deca8c..80ba99f40d 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtLayout.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtLayout.java @@ -109,11 +109,6 @@ public class QtLayout extends ViewGroup maxWidth = maxMetrics.widthPixels; maxHeight = maxMetrics.heightPixels; - density = appMetrics.density; - xdpi = appMetrics.xdpi; - ydpi = appMetrics.ydpi; - scaledDensity = appMetrics.scaledDensity; - } else { // after API 30 use getCurrentWindowMetrics for application metrics // getMaximumWindowMetrics for the screen metrics @@ -138,17 +133,14 @@ public class QtLayout extends ViewGroup maxWidth = maxMetrics.getBounds().width(); maxHeight = maxMetrics.getBounds().height(); - final Resources resources = activity.getResources(); - final Configuration configuration = resources.getConfiguration(); - density = configuration.densityDpi / (float) DisplayMetrics.DENSITY_DEFAULT; - - final DisplayMetrics displayMetrics = resources.getDisplayMetrics(); - xdpi = displayMetrics.xdpi; - ydpi = displayMetrics.ydpi; - density = displayMetrics.density; - scaledDensity = displayMetrics.scaledDensity; } + final DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); + xdpi = displayMetrics.xdpi; + ydpi = displayMetrics.ydpi; + density = displayMetrics.density; + scaledDensity = displayMetrics.scaledDensity; + float refreshRate = display.getRefreshRate(); if ((appWidth > appHeight) != (w > h)) { diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index 451a8d84cb..b2fa2ed3e5 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -476,7 +476,7 @@ static const int androidLogicalDpi = 72; QDpi QAndroidPlatformScreen::logicalDpi() const { - qreal lDpi = QtAndroid::scaledDensity() * androidLogicalDpi; + qreal lDpi = QtAndroid::pixelDensity() * androidLogicalDpi; return QDpi(lDpi, lDpi); }