From 1b27fafbfb37167d1eb17b424c2723a57f9fc0ee Mon Sep 17 00:00:00 2001 From: donghualin Date: Tue, 15 Feb 2022 13:34:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E8=93=9D?= =?UTF-8?q?=E7=89=99=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 监控当前的QEvent事件,如果是EnabledChange事件,则调整调色板颜色 Log: 修改飞行模式下蓝牙列表看不清的问题 Influence: 任务栏-网络列表,开启飞行模式,查看列表文本 Bug: https://pms.uniontech.com/zentao/bug-view-113176.html Change-Id: I3384437144d1d4598a7a1e16a27cf3b7cf897dc2 --- .../bluetooth/componments/bluetoothapplet.cpp | 19 +++++++++++++++++++ .../bluetooth/componments/bluetoothapplet.h | 2 ++ 2 files changed, 21 insertions(+) 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;