Source trigger patch file drop (#1236)

* Add Signal if File dropped

* Check if Index is valid

Send Signal and return if Index is invalid and File was dropped

* Connect Dropsignal to fileopen
This commit is contained in:
SourceTrigger
2017-11-20 21:05:47 +01:00
committed by Martin Kleusberg
parent 09e170f75d
commit 0a995423fa
3 changed files with 10 additions and 0 deletions

View File

@@ -543,6 +543,14 @@ void ExtendedTableWidget::dragMoveEvent(QDragMoveEvent* event)
void ExtendedTableWidget::dropEvent(QDropEvent* event)
{
QModelIndex index = indexAt(event->pos());
if (!index.isValid())
{
if (event->mimeData()->hasUrls() && event->mimeData()->urls().first().isLocalFile())
emit openFileFromDropEvent(event->mimeData()->urls().first().toLocalFile());
return;
}
model()->dropMimeData(event->mimeData(), Qt::CopyAction, index.row(), index.column(), QModelIndex());
event->acceptProposedAction();
}