diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 79b084f5f..e71902c25 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -143,6 +143,7 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) { home = new OffroadHome(); layout->addWidget(home, 0, 0); QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SLOT(setVisibility(bool))); + QObject::connect(glWindow, SIGNAL(offroadTransition(bool)), this, SIGNAL(offroadTransition(bool))); QObject::connect(this, SIGNAL(openSettings()), home, SLOT(refresh())); setLayout(layout); setStyleSheet(R"( diff --git a/selfdrive/ui/qt/home.hpp b/selfdrive/ui/qt/home.hpp index 11e5fb671..419c27933 100644 --- a/selfdrive/ui/qt/home.hpp +++ b/selfdrive/ui/qt/home.hpp @@ -83,6 +83,7 @@ public: GLWindow* glWindow; signals: + void offroadTransition(bool offroad); void openSettings(); protected: diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index 71b4e2194..239eb6a6a 100644 --- a/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/qt/window.cc @@ -15,6 +15,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { main_layout->setMargin(0); setLayout(main_layout); QObject::connect(homeWindow, SIGNAL(openSettings()), this, SLOT(openSettings())); + QObject::connect(homeWindow, SIGNAL(offroadTransition(bool)), this, SLOT(offroadTransition(bool))); QObject::connect(settingsWindow, SIGNAL(closeSettings()), this, SLOT(closeSettings())); // start at onboarding @@ -29,6 +30,12 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { )"); } +void MainWindow::offroadTransition(bool offroad){ + if(!offroad){ + closeSettings(); + } +} + void MainWindow::openSettings() { main_layout->setCurrentWidget(settingsWindow); } diff --git a/selfdrive/ui/qt/window.hpp b/selfdrive/ui/qt/window.hpp index 10822f1fb..2c61ac07c 100644 --- a/selfdrive/ui/qt/window.hpp +++ b/selfdrive/ui/qt/window.hpp @@ -23,6 +23,7 @@ private: OnboardingWindow *onboardingWindow; public slots: + void offroadTransition(bool offroad); void openSettings(); void closeSettings(); };