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. 22
      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);
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);
QObject::connect(reboot_btn, &QPushButton::clicked, [=]() {
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");
poweroff_btn->setStyleSheet("height: 120px;border-radius: 15px; background-color: #E22C2C;");
poweroff_btn->setObjectName("poweroff_btn");
power_layout->addWidget(poweroff_btn);
QObject::connect(poweroff_btn, &QPushButton::clicked, [=]() {
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);
}
@ -298,6 +308,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
// close button
QPushButton *close_btn = new QPushButton("×");
close_btn->setStyleSheet(R"(
QPushButton {
font-size: 140px;
padding-bottom: 20px;
font-weight: bold;
@ -305,6 +316,10 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
border-radius: 100px;
background-color: #292929;
font-weight: 400;
}
QPushButton:pressed {
background-color: #3B3B3B;
}
)");
close_btn->setFixedSize(200, 200);
sidebar_layout->addSpacing(45);
@ -349,6 +364,9 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QPushButton:checked {
color: white;
}
QPushButton:pressed {
color: #ADADAD;
}
)").arg(padding));
nav_btns->addButton(btn);

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

Loading…
Cancel
Save