diff --git a/quicksettings/screenrotation/screenrotationutil.cpp b/quicksettings/screenrotation/screenrotationutil.cpp index 4e94a9a8..4d0997f7 100644 --- a/quicksettings/screenrotation/screenrotationutil.cpp +++ b/quicksettings/screenrotation/screenrotationutil.cpp @@ -22,8 +22,13 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent) { connect(m_sensor, &QOrientationSensor::activeChanged, this, &ScreenRotationUtil::availableChanged); + connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, [this]() { + Q_EMIT autoScreenRotationEnabledChanged(); + }); + connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) { m_config = qobject_cast(op)->config(); + KScreen::ConfigMonitor::instance()->addConfig(m_config); // update all screens with event connect for (KScreen::OutputPtr output : m_config->outputs()) { diff --git a/quicksettings/screenrotation/screenrotationutil.h b/quicksettings/screenrotation/screenrotationutil.h index 0039720a..ac7af15b 100644 --- a/quicksettings/screenrotation/screenrotationutil.h +++ b/quicksettings/screenrotation/screenrotationutil.h @@ -29,8 +29,8 @@ Q_SIGNALS: private: void actuallySetAutoScreenRotationEnabled(bool value); - KScreen::ConfigPtr m_config; - QOrientationSensor *m_sensor; + KScreen::ConfigPtr m_config{nullptr}; + QOrientationSensor *m_sensor{nullptr}; - bool m_available; + bool m_available{false}; };