NOISSUE Try to enable dragging accross views

This commit is contained in:
janrupf
2019-06-19 19:46:35 +02:00
committed by Petr Mrázek
parent cec5f7332e
commit 4233e0c014
4 changed files with 53 additions and 5 deletions

View File

@@ -35,8 +35,10 @@ ModListView::ModListView ( QWidget* parent )
setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
setDropIndicatorShown(true);
setDragEnabled(true);
setDragDropMode(QAbstractItemView::DropOnly);
setDragDropMode(QAbstractItemView::DragDrop);
viewport()->setAcceptDrops(true);
setAcceptDrops(true);
setDefaultDropAction(Qt::CopyAction);
}
void ModListView::setModel ( QAbstractItemModel* model )
@@ -64,3 +66,18 @@ void ModListView::setModel ( QAbstractItemModel* model )
head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
}
}
void ModListView::dragEnterEvent(QDragEnterEvent *event)
{
event->accept();
}
void ModListView::dragMoveEvent(QDragMoveEvent *event)
{
event->accept();
}
void ModListView::dropEvent(QDropEvent *event)
{
QAbstractItemView::dropEvent(event);
}