bugfix:drag item outside the dock and release cause item can't request-docked again

Change-Id: Ie6442927fa6043424b37a6575b96c5c0c2602f65
This commit is contained in:
杨万青 2015-09-22 10:52:22 +08:00 committed by yangwanqing
parent 6154520ffa
commit 86bb370595
Notes: Deepin Code Review 2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: <mr.asianwang@gmail.com>
Submitted-by: <mr.asianwang@gmail.com>
Submitted-at: Tue, 22 Sep 2015 15:03:05 +0800
Reviewed-on: https://cr.deepin.io/7248
Project: dde/dde-dock
Branch: refs/heads/master
4 changed files with 13 additions and 0 deletions

View File

@ -198,6 +198,9 @@ void Panel::initScreenMask()
void Panel::onItemDropped()
{
m_maskWidget->hide();
AppItem *item = qobject_cast<AppItem *>(m_appLayout->getDraggingItem());
if (item)
m_ddam->RequestUndock(item->itemData().id);
m_appLayout->clearTmpItem();
m_appLayout->relayout();
}

View File

@ -75,6 +75,7 @@ private:
private:
PreviewFrame *m_globalPreview = new PreviewFrame;
DBusDockedAppManager *m_ddam = new DBusDockedAppManager(this);
DockModeData *m_dockModeData = DockModeData::instance();
QPropertyAnimation *m_widthAnimation = NULL;
DBusHideStateManager *m_HSManager = NULL;

View File

@ -132,6 +132,14 @@ QList<AbstractDockItem *> DockLayout::getItemList() const
return m_appList;
}
AbstractDockItem *DockLayout::getDraggingItem() const
{
if (m_dragItemMap.isEmpty())
return NULL;
else
return m_dragItemMap.firstKey();
}
//to recover some damage cause by error
//e.g: item has been drag to some place which can't receive drop event cause item miss
void DockLayout::restoreTmpItem()

View File

@ -38,6 +38,7 @@ public:
int getContentsWidth();
int getItemCount() const;
QList<AbstractDockItem *> getItemList() const;
AbstractDockItem *getDraggingItem() const;
signals:
void startDrag();