diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index bbe984bebe0..e22037c1e99 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -533,4 +533,53 @@ void QPlatformScreen::setPowerState(PowerState state) Q_UNUSED(state); } +/*! + Reimplement this function in subclass to return the list + of modes for this screen. + + The default implementation returns a list with + only one mode from the current screen size and refresh rate. + + \sa QPlatformScreen::geometry + \sa QPlatformScreen::refreshRate + + \since 5.9 +*/ +QVector QPlatformScreen::modes() const +{ + QVector list; + list.append({geometry().size(), refreshRate()}); + return list; +} + +/*! + Reimplement this function in subclass to return the + index of the current mode from the modes list. + + The default implementation returns 0. + + \sa QPlatformScreen::modes + + \since 5.9 +*/ +int QPlatformScreen::currentMode() const +{ + return 0; +} + +/*! + Reimplement this function in subclass to return the preferred + mode index from the modes list. + + The default implementation returns 0. + + \sa QPlatformScreen::modes + + \since 5.9 +*/ +int QPlatformScreen::preferredMode() const +{ + return 0; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h index aa32917b6c5..97fe3fed03a 100644 --- a/src/gui/kernel/qplatformscreen.h +++ b/src/gui/kernel/qplatformscreen.h @@ -95,6 +95,11 @@ public: PowerStateOff }; + struct Mode { + QSize size; + qreal refreshRate; + }; + QPlatformScreen(); virtual ~QPlatformScreen(); @@ -139,6 +144,11 @@ public: virtual PowerState powerState() const; virtual void setPowerState(PowerState state); + virtual QVector modes() const; + + virtual int currentMode() const; + virtual int preferredMode() const; + static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b); static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target); static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);