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
Change-Id: I2107015a07f30167c9f7324959b47ada0a75988d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ada114f8b37b62fe80332105507b1afc20424aa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Safiyyah Moosa 2025-03-11 23:05:46 +01:00 committed by Qt Cherry-pick Bot
parent 657ccdab53
commit 1f6346df1c

View File

@ -1391,12 +1391,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
{