mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
quicksettings/screenrotation: Fix initial state of quicksetting always being off
Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/298
This commit is contained in:
parent
6f67fdd0c5
commit
fffcd04aeb
1 changed files with 4 additions and 2 deletions
|
|
@ -25,7 +25,6 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent)
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
|
||||||
// update all screens with event connect
|
// update all screens with event connect
|
||||||
Q_EMIT autoScreenRotationEnabledChanged();
|
|
||||||
for (KScreen::OutputPtr output : m_config->outputs()) {
|
for (KScreen::OutputPtr output : m_config->outputs()) {
|
||||||
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
@ -35,6 +34,9 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent)
|
||||||
Q_EMIT autoScreenRotationEnabledChanged();
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// trigger update
|
||||||
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +48,7 @@ bool ScreenRotationUtil::autoScreenRotationEnabled()
|
||||||
const auto outputs = m_config->outputs();
|
const auto outputs = m_config->outputs();
|
||||||
|
|
||||||
for (KScreen::OutputPtr output : outputs) {
|
for (KScreen::OutputPtr output : outputs) {
|
||||||
if (output->autoRotatePolicy() != KScreen::Output::AutoRotatePolicy::Always) {
|
if (output->autoRotatePolicy() == KScreen::Output::AutoRotatePolicy::Never) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue