mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 17:35:43 +00:00
Added support for dragging/dropping resources; you can use drag/drop to rearrange resources/folders in the resource browser now, and you can drag/drop resources onto resource selector widgets
This commit is contained in:
20
src/Editor/ResourceBrowser/CResourceTableView.cpp
Normal file
20
src/Editor/ResourceBrowser/CResourceTableView.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "CResourceTableView.h"
|
||||
#include <QDragEnterEvent>
|
||||
|
||||
CResourceTableView::CResourceTableView(QWidget *pParent /*= 0*/)
|
||||
: QTableView(pParent)
|
||||
{}
|
||||
|
||||
void CResourceTableView::dragEnterEvent(QDragEnterEvent *pEvent)
|
||||
{
|
||||
// need to reimplement this to fix a bug in QAbstractItemView
|
||||
if (dragDropMode() == QAbstractItemView::InternalMove &&
|
||||
(pEvent->source() != this || ((pEvent->possibleActions() & Qt::MoveAction) == 0)) )
|
||||
return;
|
||||
|
||||
if (pEvent->possibleActions() & model()->supportedDropActions())
|
||||
{
|
||||
pEvent->accept();
|
||||
setState(QAbstractItemView::DraggingState);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user