From 509477c904ea7b6e23cfb6df98756a960fbdb485 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 4 Jan 2025 09:59:55 -0500 Subject: [PATCH] reset to main panel when clicked away --- .../qt/offroad/settings/sunnypilot_panel.cc | 14 ++++++++++++++ .../qt/offroad/settings/sunnypilot_panel.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc index 6a09a5426f..eddc701f93 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc @@ -64,3 +64,17 @@ SunnypilotPanel::SunnypilotPanel(SettingsWindowSP *parent) : QFrame(parent) { main_layout->setCurrentWidget(sunnypilotScreen); } + +void SunnypilotPanel::showEvent(QShowEvent *event) { + updateToggles(); +} + +void SunnypilotPanel::hideEvent(QHideEvent *event) { + main_layout->setCurrentWidget(sunnypilotScreen); +} + +void SunnypilotPanel::updateToggles() { + if (!isVisible()) { + return; + } +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h index 93bbf72370..edb145ca61 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h @@ -21,6 +21,11 @@ class SunnypilotPanel : public QFrame { public: explicit SunnypilotPanel(SettingsWindowSP *parent = nullptr); + void showEvent(QShowEvent *event) override; + void hideEvent(QHideEvent* event) override; + +public slots: + void updateToggles(); private: QStackedLayout* main_layout = nullptr;