settings: button press states (#21771)

* settings button press states

* tune color

* states for panel labels and close btn
pull/21784/head
sshane 4 years ago committed by GitHub
parent b69c304748
commit 4ed4956240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      selfdrive/ui/qt/offroad/settings.cc
  2. 3
      selfdrive/ui/qt/widgets/controls.cc

@ -169,7 +169,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
power_layout->setSpacing(30); power_layout->setSpacing(30);
QPushButton *reboot_btn = new QPushButton("Reboot"); QPushButton *reboot_btn = new QPushButton("Reboot");
reboot_btn->setStyleSheet("height: 120px;border-radius: 15px; background-color: #393939;"); reboot_btn->setObjectName("reboot_btn");
power_layout->addWidget(reboot_btn); power_layout->addWidget(reboot_btn);
QObject::connect(reboot_btn, &QPushButton::clicked, [=]() { QObject::connect(reboot_btn, &QPushButton::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) { if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) {
@ -178,7 +178,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
}); });
QPushButton *poweroff_btn = new QPushButton("Power Off"); QPushButton *poweroff_btn = new QPushButton("Power Off");
poweroff_btn->setStyleSheet("height: 120px;border-radius: 15px; background-color: #E22C2C;"); poweroff_btn->setObjectName("poweroff_btn");
power_layout->addWidget(poweroff_btn); power_layout->addWidget(poweroff_btn);
QObject::connect(poweroff_btn, &QPushButton::clicked, [=]() { QObject::connect(poweroff_btn, &QPushButton::clicked, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) { if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) {
@ -186,6 +186,16 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
} }
}); });
setStyleSheet(R"(
QPushButton {
height: 120px;
border-radius: 15px;
}
#reboot_btn { background-color: #393939; }
#reboot_btn:pressed { background-color: #4a4a4a; }
#poweroff_btn { background-color: #E22C2C; }
#poweroff_btn:pressed { background-color: #FF2424; }
)");
main_layout->addLayout(power_layout); main_layout->addLayout(power_layout);
} }
@ -298,13 +308,18 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
// close button // close button
QPushButton *close_btn = new QPushButton("×"); QPushButton *close_btn = new QPushButton("×");
close_btn->setStyleSheet(R"( close_btn->setStyleSheet(R"(
font-size: 140px; QPushButton {
padding-bottom: 20px; font-size: 140px;
font-weight: bold; padding-bottom: 20px;
border 1px grey solid; font-weight: bold;
border-radius: 100px; border 1px grey solid;
background-color: #292929; border-radius: 100px;
font-weight: 400; background-color: #292929;
font-weight: 400;
}
QPushButton:pressed {
background-color: #3B3B3B;
}
)"); )");
close_btn->setFixedSize(200, 200); close_btn->setFixedSize(200, 200);
sidebar_layout->addSpacing(45); sidebar_layout->addSpacing(45);
@ -349,6 +364,9 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QPushButton:checked { QPushButton:checked {
color: white; color: white;
} }
QPushButton:pressed {
color: #ADADAD;
}
)").arg(padding)); )").arg(padding));
nav_btns->addButton(btn); nav_btns->addButton(btn);

@ -78,6 +78,9 @@ ButtonControl::ButtonControl(const QString &title, const QString &text, const QS
color: #E4E4E4; color: #E4E4E4;
background-color: #393939; background-color: #393939;
} }
QPushButton:pressed {
background-color: #4a4a4a;
}
QPushButton:disabled { QPushButton:disabled {
color: #33E4E4E4; color: #33E4E4E4;
} }

Loading…
Cancel
Save