Commit 31d0b988 authored by Xaver Hugl's avatar Xaver Hugl

add setCurrentMode(size,refreshRate)

parent d237254e
Pipeline #43849 passed with stage
in 6 minutes and 6 seconds
......@@ -265,6 +265,21 @@ void OutputDeviceInterface::setCurrentMode(const int modeId)
emit currentModeChanged();
}
bool OutputDeviceInterface::setCurrentMode(const QSize &size, int refreshRate)
{
Q_D();
auto mode = std::find_if(d->modes.constBegin(), d->modes.constEnd(),
[size, refreshRate](const Mode &mode) {
return mode.size == size && mode.refreshRate == refreshRate;
}
);
if (mode == d->modes.constEnd()) {
return false;
}
setCurrentMode((*mode).id);
return true;
}
int32_t OutputDeviceInterface::Private::toTransform() const
{
switch (transform) {
......
......@@ -135,6 +135,11 @@ public:
*/
void addMode(Mode &mode);
void setCurrentMode(const int modeId);
/**
* Makes the mode with the specified @a size and @a refreshRate current.
* Returns @c false if no mode with the given attributes exists; otherwise returns @c true.
*/
bool setCurrentMode(const QSize &size, int refreshRate);
void setEdid(const QByteArray &edid);
void setEnabled(OutputDeviceInterface::Enablement enabled);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment