mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 06:53:46 +00:00
fix: 修复黑色背景下蓝牙列表名称颜色显示错误
蓝牙设备名称对应的DLabel增加主题变化后改变颜色 Log: Influence: 改变主题,观察蓝牙列表设备名称的颜色是否改变 Bug: https://pms.uniontech.com/bug-view-167961.html Change-Id: I7a22e77688aa8767eb6e3439d9885cd871945cde
This commit is contained in:
parent
455402d640
commit
460705c401
@ -60,8 +60,9 @@ SettingLabel::SettingLabel(QString text, QWidget *parent)
|
||||
p.setColor(QPalette::Background, Qt::transparent);
|
||||
this->setPalette(p);
|
||||
|
||||
m_label->setForegroundRole(QPalette::BrightText);
|
||||
onThemeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
||||
updateEnabledStatus();
|
||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &SettingLabel::onThemeTypeChanged);
|
||||
}
|
||||
|
||||
void SettingLabel::addButton(QWidget *button, int space)
|
||||
@ -80,6 +81,17 @@ void SettingLabel::updateEnabledStatus()
|
||||
m_label->setPalette(p);
|
||||
}
|
||||
|
||||
void SettingLabel::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType)
|
||||
{
|
||||
QPalette palette = m_label->palette();
|
||||
if (themeType == DGuiApplicationHelper::ColorType::LightType)
|
||||
palette.setColor(QPalette::BrightText, Qt::black);
|
||||
else
|
||||
palette.setColor(QPalette::BrightText, Qt::white);
|
||||
|
||||
m_label->setPalette(palette);
|
||||
}
|
||||
|
||||
void SettingLabel::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::EnabledChange)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <dtkwidget_global.h>
|
||||
#include <DGuiApplicationHelper>
|
||||
|
||||
#include "org_deepin_dde_airplanemode1.h"
|
||||
|
||||
@ -47,6 +48,7 @@ class DListView;
|
||||
DWIDGET_END_NAMESPACE
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
DGUI_USE_NAMESPACE
|
||||
|
||||
using DBusAirplaneMode = org::deepin::dde::AirplaneMode1;
|
||||
|
||||
@ -68,6 +70,9 @@ protected:
|
||||
|
||||
void updateEnabledStatus();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType);
|
||||
|
||||
private:
|
||||
DLabel *m_label;
|
||||
QHBoxLayout *m_layout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user