From f5483227539f3be2c47af6d7bd4ec18d5dc5bb2b Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 5 Oct 2023 00:13:23 -0400 Subject: [PATCH] ui: `ButtonParamControl` style update --- selfdrive/ui/qt/widgets/controls.h | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/selfdrive/ui/qt/widgets/controls.h b/selfdrive/ui/qt/widgets/controls.h index 67e6b03863..baee0bd6e5 100644 --- a/selfdrive/ui/qt/widgets/controls.h +++ b/selfdrive/ui/qt/widgets/controls.h @@ -253,13 +253,18 @@ public: QPushButton:pressed { background-color: #4a4a4a; } + QPushButton:enabled { + color: #33E4E4E4; + } QPushButton:checked:enabled { background-color: #696868; + color: #E4E4E4; } QPushButton:checked:enabled:hover { border: 4px solid #696868; border-radius: 15px; background-color: #696868; + color: #E4E4E4; } QPushButton:disabled { color: #33E4E4E4; @@ -310,24 +315,22 @@ protected: QPainter p(this); p.setRenderHint(QPainter::Antialiasing); - if (button_group_enabled) { - // Calculate the total width and height for the background rectangle - int w = 0; - int h = 124; + // Calculate the total width and height for the background rectangle + int w = 0; + int h = 124; - for (int i = 0; i < hlayout->count(); ++i) { - QPushButton *button = qobject_cast(hlayout->itemAt(i)->widget()); - if (button) { - w += button->width(); - } + for (int i = 0; i < hlayout->count(); ++i) { + QPushButton *button = qobject_cast(hlayout->itemAt(i)->widget()); + if (button) { + w += button->width(); } - - // Draw the background rectangle - QRect rect(0 + 2, h + 2, w, h); - p.setBrush(Qt::NoBrush); // Background color - p.setPen(QPen(QColor("#696868"), 3)); - p.drawRoundedRect(rect, 15, 15); } + + // Draw the background rectangle + QRect rect(0 + 2, h + 2, w, h); + p.setBrush(button_group_enabled ? QColor(0, 0, 0, 0) : QColor("#393939")); // Background color + p.setPen(button_group_enabled ? (QPen(QColor("#696868"), 3)) : QPen(Qt::NoPen)); + p.drawRoundedRect(rect, 15, 15); } private: