diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2016-12-14 06:37:39 +0100 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org> | 2017-01-28 16:13:38 +0000 |
commit | 5ad191850becd7dc1d61d0975f141a5db64e6373 (patch) | |
tree | 23807a77f18a3fecabc64f5ae53faee59b566563 /src/gui/kernel/qplatformscreen.cpp | |
parent | 8b9b27bced5227fae0f44a92a24183f38c944c02 (diff) |
Modes API for QPlatformScreen
Add an API for modes (that is screen size and refresh rate).
This will allow platform plugins to list modes available
for a screen.
[ChangeLog][QtGui][QPA] Add an API for modes.
Change-Id: I91851c51cc60a1544465dfa3b4d96cc667237a0a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformscreen.cpp')
-rw-r--r-- | src/gui/kernel/qplatformscreen.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index bbe984bebe..e22037c1e9 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::Mode> QPlatformScreen::modes() const +{ + QVector<QPlatformScreen::Mode> 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 |