Discourage use of QScreen::devicePixelRatio()

Remove line about "common values" which is now not
100% accurate and uses the outdated "retina" term.

Add note which encourages using QWindow::devicePixelRatio()
to get the correct DPR value in all cases.

Task-number: QTBUG-135612
Change-Id: I78e049cb2f0661b62bc3e2520a4b3cbf1fde241d
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Sørvig 2025-04-08 11:06:42 +02:00 committed by Morten Johan Sørvig
parent 59d77a0162
commit 9240b9ace5

View File

@ -278,8 +278,9 @@ qreal QScreen::logicalDotsPerInch() const
Returns the ratio between physical pixels and device-independent pixels for the screen. 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 "retina" displays. This function may return a value that differs from QWindow::devicePixelRatio(),
Higher values are also possible. for instance on Wayland when using fractional scaling, or if window properties
that affect surface resolution are set. Prefer using QWindow::devicePixelRatio().
\note On some platforms the devicePixelRatio of a window and the screen it is on can \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. be different. Use this function only when you don't know which window you are targeting.