DevicePanel: set specific stylesheet for reboot & poweroff buttons (#21364)

* set specific stylesheet for reboot&poweroff buttons

* remove hack

* fix css in network panel
old-commit-hash: c9d4dfe99fbc49e5db16292200e7daef3295dfb3
This commit is contained in:
Dean Lee
2021-06-23 04:24:55 +08:00
committed by GitHub
parent e57dab8f40
commit f883cfec39
3 changed files with 7 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ void Networking::attemptInitialization() {
QVBoxLayout* vlayout = new QVBoxLayout(wifiScreen);
if (show_advanced) {
QPushButton* advancedSettings = new QPushButton("Advanced");
advancedSettings->setObjectName("advancedBtn");
advancedSettings->setStyleSheet("margin-right: 30px;");
advancedSettings->setFixedSize(350, 100);
connect(advancedSettings, &QPushButton::released, [=]() { main_layout->setCurrentWidget(an); });
@@ -62,6 +63,7 @@ void Networking::attemptInitialization() {
}
wifiWidget = new WifiUI(this, wifi);
wifiWidget->setObjectName("wifiWidget");
connect(wifiWidget, &WifiUI::connectToNetwork, this, &Networking::connectToNetwork);
vlayout->addWidget(new ScrollView(wifiWidget, this), 1);
@@ -72,7 +74,7 @@ void Networking::attemptInitialization() {
main_layout->addWidget(an);
setStyleSheet(R"(
QPushButton {
#wifiWidget > QPushButton, #back_btn, #advancedBtn {
font-size: 50px;
margin: 0px;
padding: 15px;
@@ -81,7 +83,7 @@ void Networking::attemptInitialization() {
color: #dddddd;
background-color: #444444;
}
QPushButton:disabled {
#wifiWidget > QPushButton:disabled {
color: #777777;
background-color: #222222;
}
@@ -140,6 +142,7 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
// Back button
QPushButton* back = new QPushButton("Back");
back->setObjectName("back_btn");
back->setFixedSize(500, 100);
connect(back, &QPushButton::released, [=]() { emit backPress(); });
main_layout->addWidget(back, 0, Qt::AlignLeft);

View File

@@ -178,6 +178,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;");
power_layout->addWidget(reboot_btn);
QObject::connect(reboot_btn, &QPushButton::released, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) {
@@ -186,7 +187,7 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
});
QPushButton *poweroff_btn = new QPushButton("Power Off");
poweroff_btn->setStyleSheet("background-color: #E22C2C;");
poweroff_btn->setStyleSheet("height: 120px;border-radius: 15px;background-color: #E22C2C;");
power_layout->addWidget(poweroff_btn);
QObject::connect(poweroff_btn, &QPushButton::released, [=]() {
if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) {
@@ -195,15 +196,6 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
});
main_layout->addLayout(power_layout);
setStyleSheet(R"(
QPushButton {
padding: 0;
height: 120px;
border-radius: 15px;
background-color: #393939;
}
)");
}
SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {

View File

@@ -54,8 +54,6 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
description->setVisible(!description->isVisible());
});
}
setStyleSheet("background-color: transparent;");
}
void AbstractControl::hideEvent(QHideEvent *e) {