add request undock interface

Change-Id: I073253c7021a81de888c22d79011b4ef8d13a947
This commit is contained in:
石博文 2016-06-20 16:46:53 +08:00 committed by Hualet Wang
parent a0e7d5da9f
commit 04e950d013
4 changed files with 21 additions and 3 deletions

View File

@ -38,7 +38,10 @@ void DockItemController::itemMove(DockItem * const moveItem, DockItem * const re
return;
const int moveIndex = m_itemList.indexOf(moveItem);
const int replaceIndex = m_itemList.indexOf(replaceItem);
const int replaceIndex = replaceItem->itemType() == DockItem::Placeholder ?
// disable insert after placeholder item
m_itemList.indexOf(replaceItem) - 1 :
m_itemList.indexOf(replaceItem);
m_itemList.removeAt(moveIndex);
emit itemRemoved(moveItem);

View File

@ -88,6 +88,16 @@ public Q_SLOTS: // METHODS
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
}
inline QDBusPendingReply<> RequestDock()
{
return asyncCall(QStringLiteral("RequestDock"));
}
inline QDBusPendingReply<> RequestUndock()
{
return asyncCall(QStringLiteral("RequestUndock"));
}
Q_SIGNALS: // SIGNALS
// begin property changed signals
void ActiveChanged();

View File

@ -134,7 +134,11 @@ void AppItem::startDrag()
emit dragStarted();
const Qt::DropAction result = drag->exec(Qt::MoveAction);
qDebug() << "dnd result: " << result;
qDebug() << "dnd result: " << result << drag->target();
// drag out of dock panel
if (!drag->target())
m_itemEntry->RequestUndock();
m_draging = false;
setVisible(true);

View File

@ -60,7 +60,8 @@ void MainPanel::dragEnterEvent(QDragEnterEvent *e)
// qDebug() << e->pos() << itemAt(e->pos());
DragingItem->show();
if (qobject_cast<DockItem *>(e->source()))
DragingItem->show();
}
void MainPanel::dragMoveEvent(QDragMoveEvent *e)