ProjectExplorer: Support Drag and Drop in the project tree

E.g. moving a file from one pri file to another is much simpler for the
user now.

[ChangeLog] Source files can now be drag-and-dropped between project
nodes in the project tree.

Fixes: QTCREATORBUG-6446
Change-Id: I8bd4a7588fc5f2830f6585dfcb54ab4a547bc6b0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-02-11 15:04:35 +01:00
parent 46f54c517a
commit 4079dd5cbc
3 changed files with 325 additions and 2 deletions

View File

@@ -149,7 +149,9 @@ public:
setEditTriggers(QAbstractItemView::EditKeyPressed);
setContextMenuPolicy(Qt::CustomContextMenu);
setDragEnabled(true);
setDragDropMode(QAbstractItemView::DragOnly);
setDragDropMode(QAbstractItemView::DragDrop);
viewport()->setAcceptDrops(true);
setDropIndicatorShown(true);
m_context = new IContext(this);
m_context->setContext(Context(ProjectExplorer::Constants::C_PROJECT_TREE));
m_context->setWidget(this);