mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix(blutetooth): 蓝牙插件弹框界面问题
1.选中图标样式错误。 2.列表之间没有间隔 Log: 修改了插件弹框显示问题 Bug: https://pms.uniontech.com/zentao/bug-view-52349.html Change-Id: I80dbfecf66a9fead82df3d975f325110313b9f45
This commit is contained in:
parent
cc46594180
commit
30b1ce633c
@ -35,6 +35,7 @@ DockPopupWindow::DockPopupWindow(QWidget *parent)
|
||||
m_acceptDelayTimer(new QTimer(this)),
|
||||
m_regionInter(new DRegionMonitor(this))
|
||||
{
|
||||
setMargin(0);
|
||||
m_acceptDelayTimer->setSingleShot(true);
|
||||
m_acceptDelayTimer->setInterval(100);
|
||||
|
||||
|
@ -28,7 +28,7 @@ void StateButton::paintEvent(QPaintEvent *event)
|
||||
painter.setBrush(palette().color(QPalette::Highlight));
|
||||
painter.drawPie(rect(), 0, 360 * 16);
|
||||
|
||||
QPen pen(palette().color(QPalette::Text), radius / 100.0 * 6.20, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
|
||||
QPen pen(Qt::white, radius / 100.0 * 6.20, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
|
||||
switch (m_type) {
|
||||
case Check: drawCheck(painter, pen, radius); break;
|
||||
case Fork: drawFork(painter, pen, radius); break;
|
||||
|
@ -64,11 +64,11 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
||||
, m_adapterLayout(new QVBoxLayout)
|
||||
, m_menueLayout(new QHBoxLayout)
|
||||
, m_openControlCenter(new MenueItem(this))
|
||||
, m_textLayout(new QVBoxLayout)
|
||||
, m_adaptersManager(new AdaptersManager(this))
|
||||
{
|
||||
m_line->setVisible(false);
|
||||
m_adapterLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_adapterLayout->setSpacing(20);
|
||||
|
||||
QFont defaultFont = font();
|
||||
auto titlefont = QFont(defaultFont.family(), defaultFont.pointSize() + 2);
|
||||
@ -79,6 +79,8 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
||||
m_appletName->setVisible(false);
|
||||
|
||||
m_openControlCenter->setText(tr("Bluetooth settings"));
|
||||
m_textLayout->addWidget(m_openControlCenter);
|
||||
m_textLayout->setContentsMargins(10, 0, 0, 0);
|
||||
initFontColor(m_openControlCenter);
|
||||
m_openControlCenter->setFixedHeight(ITEMHEIGHT);
|
||||
m_openControlCenter->setVisible(false);
|
||||
@ -99,7 +101,7 @@ BluetoothApplet::BluetoothApplet(QWidget *parent)
|
||||
m_centrealLayout->addLayout(appletNameLayout);
|
||||
m_centrealLayout->addWidget(m_line);
|
||||
m_centrealLayout->addLayout(m_adapterLayout);
|
||||
m_centrealLayout->addWidget(m_openControlCenter);
|
||||
m_centrealLayout->addLayout(m_textLayout);
|
||||
m_centralWidget->setLayout(m_centrealLayout);
|
||||
m_centralWidget->setFixedWidth(POPUPWIDTH);
|
||||
m_centralWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
QVBoxLayout *m_adapterLayout;
|
||||
QHBoxLayout *m_menueLayout;
|
||||
MenueItem *m_openControlCenter;
|
||||
QVBoxLayout *m_textLayout;
|
||||
|
||||
AdaptersManager *m_adaptersManager;
|
||||
|
||||
|
@ -50,7 +50,7 @@ AdapterItem::AdapterItem(AdaptersManager *adapterManager, Adapter *adapter, QWid
|
||||
m_switchItem->setChecked(adapter->powered(),false);
|
||||
m_switchItem->setLoading(adapter->discover());
|
||||
|
||||
m_deviceLayout->addWidget(m_switchItem);
|
||||
m_deviceLayout->addWidget(m_switchItem, Qt::AlignCenter);
|
||||
m_deviceLayout->addWidget(m_line);
|
||||
m_centralWidget->setFixedWidth(POPUPWIDTH);
|
||||
m_centralWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#define POPUPWIDTH (200)
|
||||
#define ITEMHEIGHT (30)
|
||||
#define CONTROLHEIGHT (35)
|
||||
#define CONTROLTITLEHEIGHT (45)
|
||||
#define LIGHTSUFFIX ("_dark.svg")
|
||||
#define DARKSUFFIX (".svg")
|
||||
#define MARGIN (12)
|
||||
|
@ -80,14 +80,10 @@ DeviceItem::DeviceItem(Device *d, QWidget *parent)
|
||||
m_title->setText(nameDecorated(m_device->name()));
|
||||
initFontColor(m_title);
|
||||
|
||||
m_line->setVisible(true);
|
||||
m_line->setVisible(false);
|
||||
m_loadingStat->setFixedSize(20, 20);
|
||||
m_loadingStat->setVisible(false);
|
||||
|
||||
auto deviceLayout = new QVBoxLayout;
|
||||
deviceLayout->setMargin(0);
|
||||
deviceLayout->setSpacing(0);
|
||||
deviceLayout->addWidget(m_line);
|
||||
auto itemLayout = new QHBoxLayout;
|
||||
itemLayout->setMargin(0);
|
||||
itemLayout->setSpacing(0);
|
||||
@ -99,8 +95,7 @@ DeviceItem::DeviceItem(Device *d, QWidget *parent)
|
||||
itemLayout->addWidget(m_state);
|
||||
itemLayout->addWidget(m_loadingStat);
|
||||
itemLayout->addSpacing(MARGIN);
|
||||
deviceLayout->addLayout(itemLayout);
|
||||
setLayout(deviceLayout);
|
||||
setLayout(itemLayout);
|
||||
|
||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, themeChanged);
|
||||
|
||||
@ -124,6 +119,18 @@ void DeviceItem::mousePressEvent(QMouseEvent *event)
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void DeviceItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
if (LightType == DApplicationHelper::instance()->themeType()) {
|
||||
QPainter painter(this);
|
||||
QRect rc = rect();
|
||||
rc.moveTop(1);
|
||||
painter.fillRect(rc, QColor(255, 255, 255, 51));
|
||||
|
||||
QWidget::paintEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceItem::changeState(const Device::State state)
|
||||
{
|
||||
switch (state) {
|
||||
@ -159,7 +166,7 @@ QString DeviceItem::nameDecorated(const QString &name)
|
||||
HorizontalSeparator::HorizontalSeparator(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setFixedHeight(1);
|
||||
setFixedHeight(2);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
@ -168,7 +175,11 @@ void HorizontalSeparator::paintEvent(QPaintEvent *e)
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), QColor(0, 0, 0, 0));
|
||||
if (LightType == DApplicationHelper::instance()->themeType()) {
|
||||
painter.fillRect(rect(), QColor(0, 0, 0, 10));
|
||||
} else if (DarkType == DApplicationHelper::instance()->themeType()) {
|
||||
painter.fillRect(rect(), QColor(255, 255, 255, 13));
|
||||
}
|
||||
}
|
||||
|
||||
MenueItem::MenueItem(QWidget *parent)
|
||||
|
@ -31,6 +31,12 @@
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
enum ColorType {
|
||||
UnknownType,
|
||||
LightType,
|
||||
DarkType
|
||||
};
|
||||
|
||||
class StateButton;
|
||||
class HorizontalSeparator;
|
||||
class DeviceItem : public QWidget
|
||||
@ -48,6 +54,7 @@ public:
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
signals:
|
||||
void clicked(Device *);
|
||||
|
@ -63,7 +63,7 @@ SwitchItem::SwitchItem(QWidget *parent)
|
||||
};
|
||||
themeChanged(DApplicationHelper::instance()->themeType());
|
||||
|
||||
setFixedHeight(CONTROLHEIGHT);
|
||||
setFixedHeight(CONTROLTITLEHEIGHT);
|
||||
auto switchLayout = new QHBoxLayout;
|
||||
switchLayout->setSpacing(0);
|
||||
switchLayout->setMargin(0);
|
||||
@ -73,7 +73,7 @@ SwitchItem::SwitchItem(QWidget *parent)
|
||||
switchLayout->addWidget(m_loadingIndicator);
|
||||
switchLayout->addSpacing(MARGIN);
|
||||
switchLayout->addWidget(m_switchBtn);
|
||||
switchLayout->addSpacing(2);
|
||||
switchLayout->addSpacing(5);
|
||||
setLayout(switchLayout);
|
||||
|
||||
connect(m_switchBtn, &DSwitchButton::toggled, [&](bool change) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user