Doc: Mention how devicePixelRatio tracks changes

Currently the QWindow::devicePixelRatio() documentation mentions that the device
pixel ratio can change, but it does not explain how to track the changes.
This patch adds that the QWindow instance receives the event of type
QEvent::DevicePixelRatioChange when the device pixel ratio changes.

Fixes: QTBUG-128182
Pick-to: 6.8 6.9
Change-Id: I2107015a07f30167c9f7324959b47ada0a75988d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Safiyyah Moosa 2025-03-11 23:05:46 +01:00
parent f3256e059f
commit ada114f8b3

View File

@ -1392,12 +1392,15 @@ Qt::ScreenOrientation QWindow::contentOrientation() const
for the window. This value is dependent on the screen the window is on,
and may change when the window is moved.
The QWindow instance receives an event of type
QEvent::DevicePixelRatioChange when the device pixel ratio changes.
Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
\note For windows not backed by a platform window, meaning that create() was not
called, the function will fall back to the associated QScreen's device pixel ratio.
\sa QScreen::devicePixelRatio()
\sa QScreen::devicePixelRatio(), QEvent::DevicePixelRatioChange
*/
qreal QWindow::devicePixelRatio() const
{