mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-27 00:42:05 +08:00
ui: don't hide sidebar twice (#28868)
* draft * draft 2 * comment and clean up * delete * better name * even better?
This commit is contained in:
@@ -34,7 +34,7 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
||||
slayout->addWidget(home);
|
||||
|
||||
onroad = new OnroadWindow(this);
|
||||
QObject::connect(onroad, &OnroadWindow::mapWindowShown, this, [=] { sidebar->hide(); });
|
||||
QObject::connect(onroad, &OnroadWindow::mapPanelRequested, this, [=] { sidebar->hide(); });
|
||||
slayout->addWidget(onroad);
|
||||
|
||||
body = new BodyWindow(this);
|
||||
|
||||
@@ -15,6 +15,8 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q
|
||||
auto map = new MapWindow(mapboxSettings);
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, map, &MapWindow::offroadTransition);
|
||||
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::openSettings, [=]() {
|
||||
|
||||
@@ -10,11 +10,8 @@ class MapPanel : public QFrame {
|
||||
public:
|
||||
explicit MapPanel(const QMapboxGLSettings &settings, QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
void showEvent(QShowEvent *event) { emit mapWindowShown(); };
|
||||
|
||||
signals:
|
||||
void mapWindowShown();
|
||||
void mapPanelRequested();
|
||||
|
||||
private:
|
||||
QStackedLayout *content_stack;
|
||||
|
||||
@@ -89,7 +89,7 @@ void OnroadWindow::offroadTransition(bool offroad) {
|
||||
auto m = new MapPanel(get_mapbox_settings());
|
||||
map = m;
|
||||
|
||||
QObject::connect(m, &MapPanel::mapWindowShown, this, &OnroadWindow::mapWindowShown);
|
||||
QObject::connect(m, &MapPanel::mapPanelRequested, this, &OnroadWindow::mapPanelRequested);
|
||||
|
||||
m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE);
|
||||
split->insertWidget(0, m);
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
bool isMapVisible() const { return map && map->isVisible(); }
|
||||
|
||||
signals:
|
||||
void mapWindowShown();
|
||||
void mapPanelRequested();
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user