diff --git a/selfdrive/ui/qt/maps/map_panel.cc b/selfdrive/ui/qt/maps/map_panel.cc index 0a1504fb6c..f1b8f812fa 100644 --- a/selfdrive/ui/qt/maps/map_panel.cc +++ b/selfdrive/ui/qt/maps/map_panel.cc @@ -17,7 +17,11 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q QObject::connect(device(), &Device::interactiveTimeout, [=]() { content_stack->setCurrentIndex(0); }); - QObject::connect(map, &MapWindow::requestVisible, this, &MapPanel::requestVisible); + QObject::connect(map, &MapWindow::requestVisible, [=](bool visible) { + // when we show the map for a new route, signal HomeWindow to hide the sidebar + if (visible) { emit mapPanelRequested(); } + setVisible(visible); + }); QObject::connect(map, &MapWindow::requestSettings, [=](bool settings) { content_stack->setCurrentIndex(settings ? 1 : 0); }); @@ -30,17 +34,10 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q content_stack->addWidget(settings); } -void MapPanel::requestVisible(bool visible) { - // when we show the map for a new route, signal HomeWindow to hide the sidebar - if (visible && !isVisible()) { - emit mapPanelRequested(); - } - setVisible(visible); -} - void MapPanel::toggleMapSettings() { // show settings if not visible, then toggle between map and settings int new_index = isVisible() ? (1 - content_stack->currentIndex()) : 1; content_stack->setCurrentIndex(new_index); - requestVisible(true); + emit mapPanelRequested(); + show(); } diff --git a/selfdrive/ui/qt/maps/map_panel.h b/selfdrive/ui/qt/maps/map_panel.h index ad724bcfbb..43a2cc7c89 100644 --- a/selfdrive/ui/qt/maps/map_panel.h +++ b/selfdrive/ui/qt/maps/map_panel.h @@ -14,7 +14,6 @@ signals: void mapPanelRequested(); public slots: - void requestVisible(bool visible); void toggleMapSettings(); private: