diff --git a/plugins/qpa/screen.cpp b/plugins/qpa/screen.cpp index 290e1eda0e..e8cd85e4f5 100644 --- a/plugins/qpa/screen.cpp +++ b/plugins/qpa/screen.cpp @@ -50,7 +50,7 @@ QImage::Format Screen::format() const QRect Screen::geometry() const { - return m_output ? m_output->geometry() : QRect(0, 0, 1, 1); + return m_output ? QRect(m_output->globalPosition(), m_output->pixelSize() / m_output->scale()) : QRect(0, 0, 1, 1); } QSizeF Screen::physicalSize() const @@ -73,5 +73,10 @@ QDpi Screen::logicalDpi() const return QPlatformScreen::logicalDpi(); } +qreal Screen::devicePixelRatio() const +{ + return m_output ? (qreal)m_output->scale() : 1.0; +} + } } diff --git a/plugins/qpa/screen.h b/plugins/qpa/screen.h index 879ad06a27..7690e1f6bc 100644 --- a/plugins/qpa/screen.h +++ b/plugins/qpa/screen.h @@ -49,6 +49,7 @@ public: QSizeF physicalSize() const override; QPlatformCursor *cursor() const override; QDpi logicalDpi() const override; + qreal devicePixelRatio() const override; private: QPointer m_output;