add setCurrentMode(size,refreshRate)
This commit is contained in:
parent
f1f36f3223
commit
b5434e51e8
2 changed files with 20 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue