mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
quicksettings/screenrotation: Ensure that state is up to date when screens are added
This commit is contained in:
parent
2329e0a15d
commit
f2836a81d7
1 changed files with 10 additions and 0 deletions
|
|
@ -24,7 +24,17 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent)
|
||||||
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
|
||||||
|
// update all screens with event connect
|
||||||
Q_EMIT autoScreenRotationEnabledChanged();
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
|
for (KScreen::OutputPtr output : m_config->outputs()) {
|
||||||
|
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
// listen to all new screens and connect
|
||||||
|
connect(m_config.data(), &KScreen::Config::outputAdded, this, [this](const auto &output) {
|
||||||
|
Q_EMIT autoScreenRotationEnabledChanged();
|
||||||
|
connect(output.data(), &KScreen::Output::autoRotatePolicyChanged, this, &ScreenRotationUtil::autoScreenRotationEnabledChanged);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue