mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: 修复蓝牙列表选中后有跳动的问题
应该是开发理解有误,特意加了这个效果,现在去除掉 Log: 修复蓝牙列表选中后有跳动的问题 Bug: https://pms.uniontech.com/zentao/bug-view-81687.html Change-Id: I060615a36c851e5e91805d51e681f02cd2e0f88c
This commit is contained in:
parent
5fce805aa2
commit
78eb30b41d
@ -36,31 +36,6 @@
|
|||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
ItemDelegate::ItemDelegate(QAbstractItemView *parent)
|
|
||||||
: DStyledItemDelegate(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ItemDelegate::paint 绘制鼠标移动到蓝牙列表某条item上的选中效果
|
|
||||||
* @param painter
|
|
||||||
* @param option
|
|
||||||
* @param index
|
|
||||||
*/
|
|
||||||
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
QStyleOptionViewItem styleOption = option;
|
|
||||||
|
|
||||||
if ((styleOption.state & QStyle::State_MouseOver)) {
|
|
||||||
styleOption.showDecorationSelected = true;
|
|
||||||
styleOption.state |= QStyle::State_Selected;
|
|
||||||
styleOption.rect += QMargins(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
DStyledItemDelegate::paint(painter, styleOption, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
BluetoothDeviceItem::BluetoothDeviceItem(QStyle *style, const Device *device, DListView *parent)
|
BluetoothDeviceItem::BluetoothDeviceItem(QStyle *style, const Device *device, DListView *parent)
|
||||||
: m_style(style)
|
: m_style(style)
|
||||||
, m_device(device)
|
, m_device(device)
|
||||||
@ -154,13 +129,10 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent)
|
|||||||
, m_adapterLabel(new SettingLabel(adapter->name(), this))
|
, m_adapterLabel(new SettingLabel(adapter->name(), this))
|
||||||
, m_adapterStateBtn(new DSwitchButton(this))
|
, m_adapterStateBtn(new DSwitchButton(this))
|
||||||
, m_deviceListview(new DListView(this))
|
, m_deviceListview(new DListView(this))
|
||||||
, m_itemDelegate(new ItemDelegate(m_deviceListview))
|
, m_itemDelegate(new DStyledItemDelegate(m_deviceListview))
|
||||||
, m_deviceModel(new QStandardItemModel(m_deviceListview))
|
, m_deviceModel(new QStandardItemModel(m_deviceListview))
|
||||||
, m_refreshBtn(new RefreshButton(this))
|
, m_refreshBtn(new RefreshButton(this))
|
||||||
, m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth",
|
, m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth", "/com/deepin/daemon/Bluetooth", QDBusConnection::sessionBus(), this))
|
||||||
"/com/deepin/daemon/Bluetooth",
|
|
||||||
QDBusConnection::sessionBus(),
|
|
||||||
this))
|
|
||||||
, m_showUnnamedDevices(false)
|
, m_showUnnamedDevices(false)
|
||||||
, m_seperator(new HorizontalSeperator(this))
|
, m_seperator(new HorizontalSeperator(this))
|
||||||
, m_bottomSeperator(new HorizontalSeperator(this))
|
, m_bottomSeperator(new HorizontalSeperator(this))
|
||||||
|
@ -54,13 +54,6 @@ class HorizontalSeperator;
|
|||||||
const QString LightString = QString(":/light/buletooth_%1_light.svg");
|
const QString LightString = QString(":/light/buletooth_%1_light.svg");
|
||||||
const QString DarkString = QString(":/dark/buletooth_%1_dark.svg");
|
const QString DarkString = QString(":/dark/buletooth_%1_dark.svg");
|
||||||
|
|
||||||
class ItemDelegate : public DStyledItemDelegate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ItemDelegate(QAbstractItemView *parent = nullptr);
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BluetoothDeviceItem : public QObject
|
class BluetoothDeviceItem : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -139,7 +132,7 @@ private:
|
|||||||
SettingLabel *m_adapterLabel;
|
SettingLabel *m_adapterLabel;
|
||||||
DSwitchButton *m_adapterStateBtn;
|
DSwitchButton *m_adapterStateBtn;
|
||||||
DListView *m_deviceListview;
|
DListView *m_deviceListview;
|
||||||
ItemDelegate *m_itemDelegate;
|
DStyledItemDelegate *m_itemDelegate;
|
||||||
QStandardItemModel *m_deviceModel;
|
QStandardItemModel *m_deviceModel;
|
||||||
RefreshButton *m_refreshBtn;
|
RefreshButton *m_refreshBtn;
|
||||||
DBusBluetooth *m_bluetoothInter;
|
DBusBluetooth *m_bluetoothInter;
|
||||||
|
@ -50,31 +50,6 @@ DWIDGET_USE_NAMESPACE
|
|||||||
DGUI_USE_NAMESPACE
|
DGUI_USE_NAMESPACE
|
||||||
using namespace Dock;
|
using namespace Dock;
|
||||||
|
|
||||||
ItemDelegate::ItemDelegate(QAbstractItemView *parent)
|
|
||||||
: DStyledItemDelegate(parent)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ItemDelegate::paint 绘制鼠标移动到音频列表某条item上的选中效果
|
|
||||||
* @param painter
|
|
||||||
* @param option
|
|
||||||
* @param index
|
|
||||||
*/
|
|
||||||
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
QStyleOptionViewItem styleOption = option;
|
|
||||||
|
|
||||||
if ((styleOption.state & QStyle::State_MouseOver)) {
|
|
||||||
styleOption.showDecorationSelected = true;
|
|
||||||
styleOption.state |= QStyle::State_Selected;
|
|
||||||
styleOption.rect += QMargins(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
DStyledItemDelegate::paint(painter, styleOption, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(const Port *)
|
Q_DECLARE_METATYPE(const Port *)
|
||||||
|
|
||||||
Port::Port(QObject *parent)
|
Port::Port(QObject *parent)
|
||||||
@ -147,7 +122,7 @@ SoundApplet::SoundApplet(QWidget *parent)
|
|||||||
, m_defSinkInter(nullptr)
|
, m_defSinkInter(nullptr)
|
||||||
, m_listView(new DListView(this))
|
, m_listView(new DListView(this))
|
||||||
, m_model(new QStandardItemModel(m_listView))
|
, m_model(new QStandardItemModel(m_listView))
|
||||||
, m_itemDelegate(new ItemDelegate(m_listView))
|
, m_itemDelegate(new DStyledItemDelegate(m_listView))
|
||||||
, m_deviceInfo("")
|
, m_deviceInfo("")
|
||||||
, m_lastPort(nullptr)
|
, m_lastPort(nullptr)
|
||||||
, m_gsettings(Utils::ModuleSettingsPtr("sound", QByteArray(), this))
|
, m_gsettings(Utils::ModuleSettingsPtr("sound", QByteArray(), this))
|
||||||
|
@ -47,13 +47,6 @@ namespace Dock{
|
|||||||
class TipsWidget;
|
class TipsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemDelegate : public DStyledItemDelegate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ItemDelegate(QAbstractItemView *parent = nullptr);
|
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Port : public QObject
|
class Port : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -164,7 +157,7 @@ private:
|
|||||||
DBusSink *m_defSinkInter;
|
DBusSink *m_defSinkInter;
|
||||||
DTK_WIDGET_NAMESPACE::DListView *m_listView;
|
DTK_WIDGET_NAMESPACE::DListView *m_listView;
|
||||||
QStandardItemModel *m_model;
|
QStandardItemModel *m_model;
|
||||||
ItemDelegate *m_itemDelegate;
|
DStyledItemDelegate *m_itemDelegate;
|
||||||
QList<Port *> m_ports;
|
QList<Port *> m_ports;
|
||||||
QString m_deviceInfo;
|
QString m_deviceInfo;
|
||||||
QPointer<Port> m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
|
QPointer<Port> m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
|
||||||
|
Loading…
x
Reference in New Issue
Block a user