ui/settings: fixed button overlap in sidebar. (#28220)

fix button overlap
old-commit-hash: 781a6fcc5f
beeps
Dean Lee 2 years ago committed by GitHub
parent 40094396b4
commit b6fe3eac41
  1. 11
      selfdrive/ui/qt/offroad/settings.cc

@ -343,7 +343,6 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QPushButton { QPushButton {
font-size: 140px; font-size: 140px;
padding-bottom: 20px; padding-bottom: 20px;
font-weight: bold;
border 1px grey solid; border 1px grey solid;
border-radius: 100px; border-radius: 100px;
background-color: #292929; background-color: #292929;
@ -379,22 +378,18 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QObject::connect(map_panel, &MapPanel::closeSettings, this, &SettingsWindow::closeSettings); QObject::connect(map_panel, &MapPanel::closeSettings, this, &SettingsWindow::closeSettings);
#endif #endif
const int padding = panels.size() > 3 ? 25 : 35;
nav_btns = new QButtonGroup(this); nav_btns = new QButtonGroup(this);
for (auto &[name, panel] : panels) { for (auto &[name, panel] : panels) {
QPushButton *btn = new QPushButton(name); QPushButton *btn = new QPushButton(name);
btn->setCheckable(true); btn->setCheckable(true);
btn->setChecked(nav_btns->buttons().size() == 0); btn->setChecked(nav_btns->buttons().size() == 0);
btn->setStyleSheet(QString(R"( btn->setStyleSheet(R"(
QPushButton { QPushButton {
color: grey; color: grey;
border: none; border: none;
background: none; background: none;
font-size: 65px; font-size: 65px;
font-weight: 500; font-weight: 500;
padding-top: %1px;
padding-bottom: %1px;
} }
QPushButton:checked { QPushButton:checked {
color: white; color: white;
@ -402,8 +397,8 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QPushButton:pressed { QPushButton:pressed {
color: #ADADAD; color: #ADADAD;
} }
)").arg(padding)); )");
btn->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
nav_btns->addButton(btn); nav_btns->addButton(btn);
sidebar_layout->addWidget(btn, 0, Qt::AlignRight); sidebar_layout->addWidget(btn, 0, Qt::AlignRight);

Loading…
Cancel
Save