mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 17:35:43 +00:00
Added drag/drop support to directory tree view
This commit is contained in:
@@ -7,17 +7,13 @@
|
||||
CResourceTableView::CResourceTableView(QWidget *pParent /*= 0*/)
|
||||
: QTableView(pParent)
|
||||
{
|
||||
// Create "rename" key shortcut
|
||||
// todo - there's no QKeySequence::Rename. Is there another standard "rename" shortcut on other platforms?
|
||||
mpRenameAction = new QAction(this);
|
||||
mpRenameAction->setShortcut( QKeySequence(Qt::Key_F2) );
|
||||
connect(mpRenameAction, SIGNAL(triggered(bool)), this, SLOT(RenameSelected()));
|
||||
addAction(mpRenameAction);
|
||||
|
||||
// todo: removed delete shortcut because it conflicts with the World Editor delete shortcut
|
||||
#if 0
|
||||
mpDeleteAction = new QAction(this);
|
||||
mpDeleteAction->setShortcut(QKeySequence::Delete);
|
||||
connect(mpDeleteAction, SIGNAL(triggered(bool)), this, SLOT(DeleteSelected()));
|
||||
addAction(mpDeleteAction);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CResourceTableView::setModel(QAbstractItemModel *pModel)
|
||||
@@ -40,27 +36,7 @@ void CResourceTableView::dragEnterEvent(QDragEnterEvent *pEvent)
|
||||
}
|
||||
}
|
||||
|
||||
void CResourceTableView::focusInEvent(QFocusEvent*)
|
||||
{
|
||||
mpRenameAction->setEnabled(true);
|
||||
}
|
||||
|
||||
void CResourceTableView::focusOutEvent(QFocusEvent*)
|
||||
{
|
||||
mpRenameAction->setEnabled(false);
|
||||
}
|
||||
|
||||
// ************ SLOTS ************
|
||||
void CResourceTableView::RenameSelected()
|
||||
{
|
||||
QModelIndexList List = selectionModel()->selectedIndexes();
|
||||
|
||||
if (List.size() == 1)
|
||||
{
|
||||
edit(List.front());
|
||||
}
|
||||
}
|
||||
|
||||
void CResourceTableView::DeleteSelected()
|
||||
{
|
||||
QModelIndexList List = selectionModel()->selectedIndexes();
|
||||
|
||||
Reference in New Issue
Block a user