mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix:Do not drag when dock icon is deleted
任务栏图标删除时取消拖拽状态 (task:13009)
This commit is contained in:
parent
2f866675cc
commit
ba695a3fc5
@ -223,6 +223,10 @@ void DockItemManager::appItemRemoved(AppItem *appItem)
|
|||||||
{
|
{
|
||||||
emit itemRemoved(appItem);
|
emit itemRemoved(appItem);
|
||||||
m_itemList.removeOne(appItem);
|
m_itemList.removeOne(appItem);
|
||||||
|
|
||||||
|
if (appItem->isDragging()) {
|
||||||
|
QDrag::cancel();
|
||||||
|
}
|
||||||
appItem->deleteLater();
|
appItem->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QDrag>
|
||||||
|
|
||||||
DockPluginsController::DockPluginsController(QObject *parent)
|
DockPluginsController::DockPluginsController(QObject *parent)
|
||||||
: AbstractPluginsController(parent)
|
: AbstractPluginsController(parent)
|
||||||
@ -85,6 +86,10 @@ void DockPluginsController::itemRemoved(PluginsItemInterface *const itemInter, c
|
|||||||
// do not delete the itemWidget object(specified in the plugin interface)
|
// do not delete the itemWidget object(specified in the plugin interface)
|
||||||
item->centralWidget()->setParent(nullptr);
|
item->centralWidget()->setParent(nullptr);
|
||||||
|
|
||||||
|
if (item->isDragging()) {
|
||||||
|
QDrag::cancel();
|
||||||
|
}
|
||||||
|
|
||||||
// just delete our wrapper object(PluginsItem)
|
// just delete our wrapper object(PluginsItem)
|
||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -432,3 +432,8 @@ void DockItem::hideNonModel()
|
|||||||
if (m_popupShown && !PopupWindow->model())
|
if (m_popupShown && !PopupWindow->model())
|
||||||
hidePopup();
|
hidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DockItem::isDragging()
|
||||||
|
{
|
||||||
|
return m_draging;
|
||||||
|
}
|
||||||
|
@ -67,6 +67,7 @@ public slots:
|
|||||||
void hidePopup();
|
void hidePopup();
|
||||||
virtual void setDraging(bool bDrag);
|
virtual void setDraging(bool bDrag);
|
||||||
|
|
||||||
|
bool isDragging();
|
||||||
signals:
|
signals:
|
||||||
void dragStarted() const;
|
void dragStarted() const;
|
||||||
void itemDropped(QObject *destination, const QPoint &dropPoint) const;
|
void itemDropped(QObject *destination, const QPoint &dropPoint) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user