diff options
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoabackingstore.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoascreen.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsscreen.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsscreen.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.h | 3 |
9 files changed, 11 insertions, 35 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index 7dc8bb8080..80757c2135 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -401,15 +401,17 @@ void QAndroidPlatformScreen::doRedraw() m_dirtyRect = QRect(); } +static const int androidLogicalDpi = 72; + QDpi QAndroidPlatformScreen::logicalDpi() const { - qreal lDpi = QtAndroid::scaledDensity() * 72; + qreal lDpi = QtAndroid::scaledDensity() * androidLogicalDpi; return QDpi(lDpi, lDpi); } -qreal QAndroidPlatformScreen::pixelDensity() const +QDpi QAndroidPlatformScreen::logicalBaseDpi() const { - return QtAndroid::pixelDensity(); + return QDpi(androidLogicalDpi, androidLogicalDpi); } Qt::ScreenOrientation QAndroidPlatformScreen::orientation() const diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h index f15aeae3fd..5dc158e351 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.h +++ b/src/plugins/platforms/android/qandroidplatformscreen.h @@ -103,7 +103,7 @@ protected: private: QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override; Qt::ScreenOrientation orientation() const override; Qt::ScreenOrientation nativeOrientation() const override; void surfaceChanged(JNIEnv *env, jobject surface, int w, int h) override; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 6015257f4e..15e0236107 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -153,7 +153,7 @@ void QNSWindowBackingStore::flush(QWindow *window, const QRegion ®ion, const // context is set up correctly (coordinate system, clipping, etc). Outside // of the normal display cycle there is no focused view, as explained above, // so we have to handle it manually. There's also a corner case inside the - // normal display cycle due to way QWidgetBackingStore composits native child + // normal display cycle due to way QWidgetRepaintManager composits native child // widgets, where we'll get a flush of a native child during the drawRect of // its parent/ancestor, and the parent/ancestor being the one locked by AppKit. // In this case we also need to lock and unlock focus manually. diff --git a/src/plugins/platforms/cocoa/qcocoascreen.h b/src/plugins/platforms/cocoa/qcocoascreen.h index 491af2fe9c..60243b79be 100644 --- a/src/plugins/platforms/cocoa/qcocoascreen.h +++ b/src/plugins/platforms/cocoa/qcocoascreen.h @@ -68,6 +68,7 @@ public: qreal devicePixelRatio() const override { return m_devicePixelRatio; } QSizeF physicalSize() const override { return m_physicalSize; } QDpi logicalDpi() const override { return m_logicalDpi; } + QDpi logicalBaseDpi() const override { return m_logicalDpi; } qreal refreshRate() const override { return m_refreshRate; } QString name() const override { return m_name; } QPlatformCursor *cursor() const override { return m_cursor; } diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 56131dcc48..a9b5860187 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -636,7 +636,7 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) // We never remove the primary display, the qpa plugin doesn't support that and it crashes. // To support it, this would be needed: // - Adjust all qnx qpa code which uses screens - // - Make QWidgetBackingStore not dereference a null paint device + // - Make QWidgetRepaintManager not dereference a null paint device // - Create platform resources ( QQnxWindow ) for all QWindow because they would be deleted // when you delete the screen diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 282c0b107e..8cd09a34eb 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -256,15 +256,6 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags) return result; } -qreal QWindowsScreen::pixelDensity() const -{ - // QTBUG-49195: Use logical DPI instead of physical DPI to calculate - // the pixel density since it is reflects the Windows UI scaling. - // High DPI auto scaling should be disabled when the user chooses - // small fonts on a High DPI monitor, resulting in lower logical DPI. - return qMax(1, qRound(logicalDpi().first / 96)); -} - /*! \brief Determine siblings in a virtual desktop system. diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 0ccebf6d71..2fd56f53cf 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -87,7 +87,7 @@ public: QImage::Format format() const override { return m_data.format; } QSizeF physicalSize() const override { return m_data.physicalSizeMM; } QDpi logicalDpi() const override { return m_data.dpi; } - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override { return QDpi(96, 96); }; qreal devicePixelRatio() const override { return 1.0; } qreal refreshRate() const override { return m_data.refreshRateHz; } QString name() const override { return m_data.name; } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8c34bd9c91..0fe22bd318 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -660,10 +660,6 @@ QImage::Format QXcbScreen::format() const int QXcbScreen::forcedDpi() const { - static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); - if (overrideDpi) - return overrideDpi; - const int forcedDpi = m_virtualDesktop->forcedDpi(); if (forcedDpi > 0) return forcedDpi; @@ -679,11 +675,6 @@ QDpi QXcbScreen::logicalDpi() const return m_virtualDesktop->dpi(); } -qreal QXcbScreen::pixelDensity() const -{ - return m_pixelDensity; -} - QPlatformCursor *QXcbScreen::cursor() const { return m_cursor; @@ -747,14 +738,6 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = sizeInMillimeters(geometry.size(), m_virtualDesktop->dpi()); - qreal dpi = forcedDpi(); - if (dpi <= 0) - dpi = geometry.width() / physicalSize().width() * qreal(25.4); - - // Use 128 as a reference DPI on small screens. This favors "small UI" over "large UI". - qreal referenceDpi = physicalSize().width() <= 320 ? 128 : 96; - - m_pixelDensity = qMax(1, qRound(dpi/referenceDpi)); m_geometry = geometry; m_availableGeometry = geometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ec3b07bfb7..62931d2500 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -161,7 +161,7 @@ public: QImage::Format format() const override; QSizeF physicalSize() const override { return m_sizeMillimeters; } QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override { return QDpi(96, 96); }; QPlatformCursor *cursor() const override; qreal refreshRate() const override { return m_refreshRate; } Qt::ScreenOrientation orientation() const override { return m_orientation; } @@ -227,7 +227,6 @@ private: Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; QXcbCursor *m_cursor; int m_refreshRate = 60; - int m_pixelDensity = 1; QEdidParser m_edid; }; |