1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

Fix dropping ou the sourcetree, qtreeview is really crappy in this case

This commit is contained in:
Leo Franchi 2011-05-26 09:37:46 -04:00
parent fd29a966eb
commit 0172515a86

View File

@ -194,13 +194,17 @@ bool
SourcesModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent )
{
SourceTreeItem* item;
qDebug() << "Got mime data dropped:" << row << column << parent << itemFromIndex( parent )->text();
if( row == -1 && column == -1 )
item = itemFromIndex( parent );
else
else if( column == 0 )
item = itemFromIndex( index( row, column, parent ) );
else // column is -1, that means the drop is happening "below" the indices. that means we actually want the one before it
item = itemFromIndex( index( row - 1, 0, parent ) );
Q_ASSERT( item );
qDebug() << "Dropping on:" << item->text();
return item->dropMimeData( data, action );
}