diff options
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 631592aace..62303eeea2 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1090,6 +1090,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::reportLogicalDotsPerInchChange( static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e)); break; + case QWindowSystemInterfacePrivate::ScreenRefreshRate: + QGuiApplicationPrivate::reportRefreshRateChange( + static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e)); + break; case QWindowSystemInterfacePrivate::ThemeChange: QGuiApplicationPrivate::processThemeChanged( static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e)); @@ -1750,6 +1754,21 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } +void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + if (!e->screen) + return; + + QScreen *s = e->screen.data(); + s->d_func()->refreshRate = e->rate; + + emit s->refreshRateChanged(s->refreshRate()); +} + void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) { if (!e->exposed) |