summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index c24609e886..aaf2b25ad4 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -806,6 +806,24 @@ Qt::ScreenOrientation QWindow::orientation() const
}
/*!
+ Returns the ratio between physical pixels and device-independent pixels
+ for the window. This value is dependent on the screen the window is on,
+ and may change when the window is moved.
+
+ Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
+
+ \sa QWindow::devicePixelRatio();
+ \sa QGuiApplicaiton::devicePixelRatio();
+*/
+qreal QWindow::devicePixelRatio() const
+{
+ Q_D(const QWindow);
+ if (!d->platformWindow)
+ return 1.0;
+ return d->platformWindow->devicePixelRatio();
+}
+
+/*!
\brief set the screen-occupation state of the window
The window \a state represents whether the window appears in the