mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: dock crashed while gragging sniItem
Log: 修复拖拽sni控件时引起的dock崩溃
This commit is contained in:
parent
83865c93de
commit
32bdd7be5e
@ -32,9 +32,10 @@ Dock::Position SNITrayItemWidget::DockPosition = Dock::Position::Bottom;
|
|||||||
using namespace Dock;
|
using namespace Dock;
|
||||||
|
|
||||||
SNITrayItemWidget::SNITrayItemWidget(const QString &sniServicePath, QWidget *parent)
|
SNITrayItemWidget::SNITrayItemWidget(const QString &sniServicePath, QWidget *parent)
|
||||||
: BaseTrayWidget(parent),
|
: BaseTrayWidget(parent)
|
||||||
m_menu(nullptr),
|
, m_dbusMenuImporter(nullptr)
|
||||||
m_updateIconTimer(new QTimer(this))
|
, m_menu(nullptr)
|
||||||
|
, m_updateIconTimer(new QTimer(this))
|
||||||
, m_updateOverlayIconTimer(new QTimer(this))
|
, m_updateOverlayIconTimer(new QTimer(this))
|
||||||
, m_updateAttentionIconTimer(new QTimer(this))
|
, m_updateAttentionIconTimer(new QTimer(this))
|
||||||
, m_sniServicePath(sniServicePath)
|
, m_sniServicePath(sniServicePath)
|
||||||
@ -785,6 +786,16 @@ bool SNITrayItemWidget::containsPoint(const QPoint &pos) {
|
|||||||
QRect rectGlobal(ptGlobal, this->size());
|
QRect rectGlobal(ptGlobal, this->size());
|
||||||
if (rectGlobal.contains(pos)) return true;
|
if (rectGlobal.contains(pos)) return true;
|
||||||
|
|
||||||
|
if (!m_menu) {
|
||||||
|
if (m_dbusMenuImporter) {
|
||||||
|
qInfo() << "importer exists: " << m_dbusMenuImporter;
|
||||||
|
m_menu = m_dbusMenuImporter->menu();
|
||||||
|
} else {
|
||||||
|
qInfo() << "importer not exists.";
|
||||||
|
initMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果菜单列表隐藏,则认为不在区域内
|
// 如果菜单列表隐藏,则认为不在区域内
|
||||||
if (!m_menu->isVisible()) return false;
|
if (!m_menu->isVisible()) return false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user