Commit 5a60c832 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Harmonize DragTool with other tools



Change-Id: I456641a0466ec7be4858629fd201a539b6c0fdfd
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 469fe52a
......@@ -202,17 +202,17 @@ QList<FormEditorItem *> AbstractFormEditorTool::filterSelectedModelNodes(const Q
return filteredItemList;
}
void AbstractFormEditorTool::dropEvent(QGraphicsSceneDragDropEvent * /* event */)
void AbstractFormEditorTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /* event */)
{
}
void AbstractFormEditorTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
void AbstractFormEditorTool::dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event)
{
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
event->accept();
view()->changeToDragTool();
view()->currentTool()->dragEnterEvent(event);
view()->currentTool()->dragEnterEvent(itemList, event);
} else {
event->ignore();
}
......
......@@ -52,23 +52,17 @@ public:
virtual ~AbstractFormEditorTool();
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) = 0;
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) = 0;
virtual void dropEvent(QGraphicsSceneDragDropEvent * event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) = 0;
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event) = 0;
virtual void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
virtual void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
virtual void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
virtual void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event);
virtual void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) = 0;
virtual void dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
virtual void dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event);
virtual void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
virtual void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) = 0;
virtual void keyPressEvent(QKeyEvent *event) = 0;
virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
......
......@@ -262,7 +262,7 @@ void DragTool::commitTransaction()
}
}
void DragTool::dropEvent(QGraphicsSceneDragDropEvent * event)
void DragTool::dropEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * event)
{
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
......@@ -291,7 +291,7 @@ static ItemLibraryEntry itemLibraryEntryFromData(const QByteArray &data)
return itemLibraryEntry;
}
void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
void DragTool::dragEnterEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * event)
{
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
......@@ -310,7 +310,7 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
}
}
void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
void DragTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * event)
{
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
......@@ -329,7 +329,7 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
}
}
void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
void DragTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{
if (m_blockMove)
return;
......
......@@ -64,16 +64,17 @@ public:
DragTool(FormEditorView* editorView);
virtual ~DragTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void dropEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragEnterEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
......@@ -88,12 +89,6 @@ public:
void beginWithPoint(const QPointF &beginPoint);
virtual void dropEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
//void beginWithPoint(const QPointF &beginPoint);
void clear() QTC_OVERRIDE;
......
......@@ -225,7 +225,7 @@ FormEditorItem *FormEditorScene::addFormEditorItem(const QmlItemNode &qmlItemNod
void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
{
currentTool()->dropEvent(event);
currentTool()->dropEvent(removeLayerItems(items(event->scenePos())), event);
if (views().first())
views().first()->setFocus();
......@@ -233,19 +233,19 @@ void FormEditorScene::dropEvent(QGraphicsSceneDragDropEvent * event)
void FormEditorScene::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
{
currentTool()->dragEnterEvent(event);
currentTool()->dragEnterEvent(removeLayerItems(items(event->scenePos())), event);
}
void FormEditorScene::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
{
currentTool()->dragLeaveEvent(event);
currentTool()->dragLeaveEvent(removeLayerItems(items(event->scenePos())), event);
return;
}
void FormEditorScene::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
{
currentTool()->dragMoveEvent(event);
currentTool()->dragMoveEvent(removeLayerItems(items(event->scenePos())), event);
}
QList<QGraphicsItem *> FormEditorScene::removeLayerItems(const QList<QGraphicsItem *> &itemList)
......
......@@ -198,12 +198,12 @@ void MoveTool::keyReleaseEvent(QKeyEvent *keyEvent)
}
}
void MoveTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void MoveTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
void MoveTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void MoveTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
......
......@@ -47,21 +47,16 @@ public:
MoveTool(FormEditorView* editorView);
~MoveTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
......
......@@ -98,12 +98,12 @@ void ResizeTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
}
}
void ResizeTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void ResizeTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
void ResizeTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void ResizeTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
......
......@@ -45,19 +45,15 @@ public:
ResizeTool(FormEditorView* editorView);
~ResizeTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
......
......@@ -211,11 +211,11 @@ void SelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
}
void SelectionTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void SelectionTool::dragLeaveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
void SelectionTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /*event*/)
void SelectionTool::dragMoveEvent(const QList<QGraphicsItem*> &/*itemList*/, QGraphicsSceneDragDropEvent * /*event*/)
{
}
......
......@@ -51,21 +51,18 @@ public:
SelectionTool(FormEditorView* editorView);
~SelectionTool();
void mousePressEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mousePressEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseReleaseEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void hoverMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *event) QTC_OVERRIDE;
void keyReleaseEvent(QKeyEvent *keyEvent) QTC_OVERRIDE;
void dragLeaveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragLeaveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void dragMoveEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneDragDropEvent * event) QTC_OVERRIDE;
void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment