mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复蓝牙列表图标、间距的问题
按照设计图进行修改 Log: Bug: https://pms.uniontech.com/zentao/bug-view-81641.html Change-Id: I4e81c0dce3da823199ca2a4da67585223e18fde6
This commit is contained in:
parent
4f95c21031
commit
5789f89530
@ -44,7 +44,5 @@ void HorizontalSeperator::paintEvent(QPaintEvent *e)
|
|||||||
QColor c = palette().color(QPalette::BrightText);
|
QColor c = palette().color(QPalette::BrightText);
|
||||||
c.setAlpha(int(0.1 * 255));
|
c.setAlpha(int(0.1 * 255));
|
||||||
|
|
||||||
painter.setPen(c);
|
|
||||||
painter.setBrush(c);
|
|
||||||
painter.fillRect(rect(), c);
|
painter.fillRect(rect(), c);
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,6 @@ BluetoothDeviceItem::~BluetoothDeviceItem()
|
|||||||
delete m_loading;
|
delete m_loading;
|
||||||
m_loading = nullptr;
|
m_loading = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_standarditem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothDeviceItem::initActionList()
|
void BluetoothDeviceItem::initActionList()
|
||||||
@ -183,8 +181,6 @@ void BluetoothAdapterItem::updateIconTheme(DGuiApplicationHelper::ColorType type
|
|||||||
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg");
|
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg");
|
||||||
else
|
else
|
||||||
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg");
|
m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg");
|
||||||
|
|
||||||
setItemHoverColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int BluetoothAdapterItem::currentDeviceCount()
|
int BluetoothAdapterItem::currentDeviceCount()
|
||||||
@ -264,22 +260,13 @@ void BluetoothAdapterItem::onDeviceNameUpdated(const Device *device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* @brief BluetoothAdapterItem::setItemHoverColor 通过代理方式根据当前主题设置蓝牙列表文字颜色和item选中颜色
|
// * @brief BluetoothAdapterItem::setItemHoverColor 通过代理方式根据当前主题设置蓝牙列表文字颜色和item选中颜色
|
||||||
*/
|
// */
|
||||||
void BluetoothAdapterItem::setItemHoverColor()
|
//void BluetoothAdapterItem::setItemHoverColor()
|
||||||
{
|
//{
|
||||||
QPalette hoverBackgroud = m_deviceListview->palette();
|
// m_deviceListview->setItemDelegate(m_itemDelegate);
|
||||||
if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) {
|
//}
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(0, 0, 0, 30));
|
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, Qt::black);
|
|
||||||
} else {
|
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::Highlight, QColor(255, 255, 255, 30));
|
|
||||||
hoverBackgroud.setColor(QPalette::Normal, QPalette::HighlightedText, Qt::white);
|
|
||||||
}
|
|
||||||
m_deviceListview->setPalette(hoverBackgroud);
|
|
||||||
m_deviceListview->setItemDelegate(m_itemDelegate);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BluetoothAdapterItem::initUi()
|
void BluetoothAdapterItem::initUi()
|
||||||
{
|
{
|
||||||
@ -301,7 +288,6 @@ void BluetoothAdapterItem::initUi()
|
|||||||
|
|
||||||
m_deviceListview->setAccessibleName("DeviceItemList");
|
m_deviceListview->setAccessibleName("DeviceItemList");
|
||||||
m_deviceListview->setModel(m_deviceModel);
|
m_deviceListview->setModel(m_deviceModel);
|
||||||
updateIconTheme(DGuiApplicationHelper::instance()->themeType());
|
|
||||||
m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight));
|
m_deviceListview->setItemSize(QSize(ItemWidth, DeviceItemHeight));
|
||||||
m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground);
|
m_deviceListview->setBackgroundType(DStyledItemDelegate::ClipCornerBackground);
|
||||||
m_deviceListview->setItemRadius(0);
|
m_deviceListview->setItemRadius(0);
|
||||||
@ -317,6 +303,8 @@ void BluetoothAdapterItem::initUi()
|
|||||||
mainLayout->addWidget(m_deviceListview);
|
mainLayout->addWidget(m_deviceListview);
|
||||||
mainLayout->addWidget(m_bottomSeperator);
|
mainLayout->addWidget(m_bottomSeperator);
|
||||||
|
|
||||||
|
m_deviceListview->setItemDelegate(m_itemDelegate);
|
||||||
|
|
||||||
updateIconTheme(DGuiApplicationHelper::instance()->themeType());
|
updateIconTheme(DGuiApplicationHelper::instance()->themeType());
|
||||||
if (m_adapter->discover()) {
|
if (m_adapter->discover()) {
|
||||||
m_refreshBtn->startRotate();
|
m_refreshBtn->startRotate();
|
||||||
|
@ -123,7 +123,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void initData();
|
void initData();
|
||||||
void setItemHoverColor();
|
// void setItemHoverColor();
|
||||||
void initUi();
|
void initUi();
|
||||||
void initConnect();
|
void initConnect();
|
||||||
void setUnnamedDevicesVisible(bool isShow);
|
void setUnnamedDevicesVisible(bool isShow);
|
||||||
|
@ -44,33 +44,19 @@ SettingLabel::SettingLabel(QString text, QWidget *parent)
|
|||||||
, m_label(new DLabel(text, this))
|
, m_label(new DLabel(text, this))
|
||||||
, m_layout(new QHBoxLayout(this))
|
, m_layout(new QHBoxLayout(this))
|
||||||
{
|
{
|
||||||
updateIconTheme();
|
|
||||||
setAccessibleName("BluetoothSettingLabel");
|
setAccessibleName("BluetoothSettingLabel");
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
m_layout->addSpacing(20);
|
m_layout->addSpacing(20);
|
||||||
m_layout->addWidget(m_label, 0, Qt::AlignLeft | Qt::AlignHCenter);
|
m_layout->addWidget(m_label, 0, Qt::AlignLeft | Qt::AlignHCenter);
|
||||||
m_layout->addStretch();
|
m_layout->addStretch();
|
||||||
connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &SettingLabel::updateIconTheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
setAutoFillBackground(true);
|
||||||
* @brief SettingLabel::updateIconTheme 根据主题的深浅设置字体的颜色,控件的背景颜色
|
QPalette p = this->palette();
|
||||||
*/
|
p.setColor(QPalette::Background, Qt::transparent);
|
||||||
void SettingLabel::updateIconTheme()
|
this->setPalette(p);
|
||||||
{
|
|
||||||
QPalette backgroud;
|
m_label->setForegroundRole(QPalette::BrightText);
|
||||||
QPalette textColor;
|
|
||||||
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType){
|
|
||||||
//蓝牙设置,电脑用户名文字显示高亮
|
|
||||||
textColor.setColor(QPalette::WindowText, QPalette::BrightText);
|
|
||||||
} else {
|
|
||||||
textColor.setColor(QPalette::WindowText, Qt::white);
|
|
||||||
}
|
|
||||||
m_label->setPalette(textColor);
|
|
||||||
backgroud.setColor(QPalette::Background, Qt::transparent);
|
|
||||||
this->setAutoFillBackground(true);
|
|
||||||
this->setPalette(backgroud);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingLabel::addButton(QWidget *button, int space)
|
void SettingLabel::addButton(QWidget *button, int space)
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
explicit SettingLabel(QString text, QWidget *parent = nullptr);
|
explicit SettingLabel(QString text, QWidget *parent = nullptr);
|
||||||
void addButton(QWidget *button, int space);
|
void addButton(QWidget *button, int space);
|
||||||
DLabel *label() { return m_label; }
|
DLabel *label() { return m_label; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
@ -59,8 +60,6 @@ protected:
|
|||||||
void mousePressEvent(QMouseEvent *ev) override;
|
void mousePressEvent(QMouseEvent *ev) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private:
|
|
||||||
void updateIconTheme();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DLabel *m_label;
|
DLabel *m_label;
|
||||||
|
@ -245,8 +245,9 @@ void SoundApplet::initUi()
|
|||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
m_centralWidget->setAutoFillBackground(false);
|
m_centralWidget->setAutoFillBackground(false);
|
||||||
viewport()->setAutoFillBackground(false);
|
viewport()->setAutoFillBackground(false);
|
||||||
|
m_listView->setItemDelegate(m_itemDelegate);
|
||||||
|
|
||||||
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
m_secondSeperator->setVisible(m_model->rowCount() > 1);
|
||||||
|
|
||||||
updateVolumeSliderStatus(Utils::SettingValue("com.deepin.dde.dock.module.sound", QByteArray(), "Enabled").toString());
|
updateVolumeSliderStatus(Utils::SettingValue("com.deepin.dde.dock.module.sound", QByteArray(), "Enabled").toString());
|
||||||
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
connect(m_gsettings, &QGSettings::changed, [ = ] (const QString &key) {
|
||||||
@ -529,7 +530,7 @@ void SoundApplet::addPort(const Port *port)
|
|||||||
}
|
}
|
||||||
m_model->appendRow(pi);
|
m_model->appendRow(pi);
|
||||||
m_model->sort(0);
|
m_model->sort(0);
|
||||||
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
m_secondSeperator->setVisible(m_model->rowCount() > 1);
|
||||||
updateListHeight();
|
updateListHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,7 +550,7 @@ void SoundApplet::removePort(const QString &portId, const uint &cardId)
|
|||||||
};
|
};
|
||||||
|
|
||||||
rmFunc(m_model);
|
rmFunc(m_model);
|
||||||
m_secondSeperator->setVisible(m_model->rowCount() > 0);
|
m_secondSeperator->setVisible(m_model->rowCount() > 1);
|
||||||
updateListHeight();
|
updateListHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,7 +674,7 @@ void SoundApplet::updateListHeight()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int visualHeight = 0;
|
int visualHeight = 0;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
visualHeight += m_listView->visualRect(m_model->index(i, 0)).height();
|
visualHeight += m_listView->visualRect(m_model->index(i, 0)).height();
|
||||||
|
|
||||||
int listMargin = m_listView->contentsMargins().top() + m_listView->contentsMargins().bottom();
|
int listMargin = m_listView->contentsMargins().top() + m_listView->contentsMargins().bottom();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user