diff options
Diffstat (limited to 'src/gui/kernel/qscreen.cpp')
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 0c30de498c..f5467ab742 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -214,6 +214,20 @@ qreal QScreen::logicalDotsPerInch() const return (dpi.first + dpi.second) * qreal(0.5); } +/* + Returns the ratio between physical pixels and device-independent pixels for the screen. + + Common values are 1.0 on normal displays and 2.0 on Apple retina displays. + + \sa QWindow::devicePixelRatio(); + \sa QGuiApplicaiton::devicePixelRatio(); +*/ +qreal QScreen::devicePixelRatio() const +{ + Q_D(const QScreen); + return d->platformScreen->devicePixelRatio(); +} + /*! \property QScreen::physicalSize \brief the screen's physical size (in millimeters) |