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>
This commit is contained in:
parent
8b9b27bced
commit
5ad191850b
@ -533,4 +533,53 @@ void QPlatformScreen::setPowerState(PowerState state)
|
|||||||
Q_UNUSED(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
|
QT_END_NAMESPACE
|
||||||
|
@ -95,6 +95,11 @@ public:
|
|||||||
PowerStateOff
|
PowerStateOff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Mode {
|
||||||
|
QSize size;
|
||||||
|
qreal refreshRate;
|
||||||
|
};
|
||||||
|
|
||||||
QPlatformScreen();
|
QPlatformScreen();
|
||||||
virtual ~QPlatformScreen();
|
virtual ~QPlatformScreen();
|
||||||
|
|
||||||
@ -139,6 +144,11 @@ public:
|
|||||||
virtual PowerState powerState() const;
|
virtual PowerState powerState() const;
|
||||||
virtual void setPowerState(PowerState state);
|
virtual void setPowerState(PowerState state);
|
||||||
|
|
||||||
|
virtual QVector<Mode> modes() const;
|
||||||
|
|
||||||
|
virtual int currentMode() const;
|
||||||
|
virtual int preferredMode() const;
|
||||||
|
|
||||||
static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
|
static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
|
||||||
static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
|
static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
|
||||||
static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
|
static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user