From 97049278443860d3dd1b1efd20d1f7dabaf72a35 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 4 Feb 2025 13:26:59 +0100 Subject: [PATCH] QScreen: Add a note to use QWindow::devicePixelRatio if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like QGuiApplication does as well. Also add a note that screen and window DPR can be different. Pick-to: 6.9 6.8 Change-Id: I1a24cf7f11e945187da9dce4421039350e811997 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qscreen.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 415acaf4303..9822fc3e1dd 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -281,6 +281,10 @@ qreal QScreen::logicalDotsPerInch() const Common values are 1.0 on normal displays and 2.0 on "retina" displays. Higher values are also possible. + \note On some platforms the devicePixelRatio of a window and the screen it is on can + be different. Use this function only when you don't know which window you are targeting. + If you do know the target window, use QWindow::devicePixelRatio() instead. + \sa QWindow::devicePixelRatio(), QGuiApplication::devicePixelRatio() */ qreal QScreen::devicePixelRatio() const