diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 24199efeb3..4fef26de24 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -92,16 +92,15 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { QHBoxLayout* header_layout = new QHBoxLayout(); date = new QLabel(); - date->setStyleSheet(R"(font-size: 55px;)"); header_layout->addWidget(date, 0, Qt::AlignHCenter | Qt::AlignLeft); alert_notification = new QPushButton(); + alert_notification->setObjectName("alert_notification"); alert_notification->setVisible(false); QObject::connect(alert_notification, &QPushButton::released, this, &OffroadHome::openAlerts); header_layout->addWidget(alert_notification, 0, Qt::AlignHCenter | Qt::AlignRight); QLabel* version = new QLabel(getBrandVersion()); - version->setStyleSheet(R"(font-size: 55px;)"); header_layout->addWidget(version, 0, Qt::AlignHCenter | Qt::AlignRight); main_layout->addLayout(header_layout); @@ -138,11 +137,23 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { timer->start(10 * 1000); setStyleSheet(R"( + * { + color: white; + } OffroadHome { background-color: black; } - * { - color: white; + #alert_notification { + padding: 15px; + padding-left: 30px; + padding-right: 30px; + border: 1px solid; + border-radius: 5px; + font-size: 40px; + font-weight: 500; + } + OffroadHome>QLabel { + font-size: 55px; } )"); } @@ -187,20 +198,6 @@ void OffroadHome::refresh() { openAlerts(); } alert_notification->setVisible(true); - // Red background for alerts, blue for update available - QString style = QString(R"( - padding: 15px; - padding-left: 30px; - padding-right: 30px; - border: 1px solid; - border-radius: 5px; - font-size: 40px; - font-weight: 500; - background-color: #E22C2C; - )"); - if (alerts_widget->updateAvailable) { - style.replace("#E22C2C", "#364DEF"); - } - alert_notification->setStyleSheet(style); + alert_notification->setStyleSheet(alerts_widget->updateAvailable ? "background-color: #364DEF" : "background-color: #E22C2C"); }