diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp index 3cceb079f..b5e9b728a 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.cpp +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -61,6 +61,7 @@ SettingLabel::SettingLabel(QString text, QWidget *parent) this->setPalette(p); m_label->setForegroundRole(QPalette::BrightText); + updateEnabledStatus(); } void SettingLabel::addButton(QWidget *button, int space) @@ -69,6 +70,24 @@ void SettingLabel::addButton(QWidget *button, int space) m_layout->addSpacing(space); } +void SettingLabel::updateEnabledStatus() +{ + QPalette p = m_label->palette(); + if (m_label->isEnabled()) + p.setColor(QPalette::BrightText, QColor(0, 0, 0)); + else + p.setColor(QPalette::BrightText, QColor(51, 51, 51)); + m_label->setPalette(p); +} + +void SettingLabel::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::EnabledChange) + updateEnabledStatus(); + + QWidget::changeEvent(event); +} + void SettingLabel::mousePressEvent(QMouseEvent *ev) { if (ev->button() == Qt::LeftButton) { diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h index 2546fdd7f..8603980b1 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.h +++ b/plugins/bluetooth/componments/bluetoothapplet.h @@ -64,7 +64,9 @@ signals: protected: void mousePressEvent(QMouseEvent *ev) override; void paintEvent(QPaintEvent *event) override; + void changeEvent(QEvent *event) override; + void updateEnabledStatus(); private: DLabel *m_label;