Skip to content

Commit

Permalink
ui: Align bottom row icons and buttons with Dev UI dynamically (comma…
Browse files Browse the repository at this point in the history
…ai#256)

* ui: Align bottom row icons and buttons with Dev UI dynamically

* fix
  • Loading branch information
sunnyhaibin authored Sep 13, 2023
1 parent 25a3fa5 commit fa1188a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions selfdrive/ui/qt/onroad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par
#endif

buttons_layout = new QHBoxLayout();
buttons_layout->setContentsMargins(0, 0, 20, 40);
buttons_layout->setContentsMargins(0, 0, 10, 20);
main_layout->addLayout(buttons_layout);
updateButtonsLayout();
}
Expand All @@ -423,13 +423,16 @@ void AnnotatedCameraWidget::updateButtonsLayout() {
delete item;
}

buttons_layout->setContentsMargins(0, 0, 10, uiState()->scene.rn_offset != 0 ? uiState()->scene.rn_offset + 10 : 20);

buttons_layout->addStretch(1);

#ifdef ENABLE_DASHCAM
buttons_layout->addWidget(recorder);
buttons_layout->addWidget(recorder, 0, Qt::AlignBottom | Qt::AlignRight);
#endif

buttons_layout->addSpacing(map_settings_btn->isVisible() ? 60 : 0);
buttons_layout->addWidget(map_settings_btn);
buttons_layout->setAlignment(Qt::AlignBottom | Qt::AlignRight);
buttons_layout->addWidget(map_settings_btn, 0, Qt::AlignBottom | Qt::AlignRight);
}

void AnnotatedCameraWidget::updateState(const UIState &s) {
Expand Down Expand Up @@ -814,7 +817,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
}

int rn_btn = 0;
rn_btn = devUiEnabled && !splitPanelVisible && devUiInfo == 1 ? 30 : 0;
rn_btn = devUiEnabled && !splitPanelVisible && devUiInfo == 1 ? 35 : 0;
uiState()->scene.rn_offset = rn_btn;

// Stand Still Timer
Expand Down

0 comments on commit fa1188a

Please sign in to comment.