1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 18:14:50 +02:00

Don't show drop indicator for playlists in sidebar and always create new ones

This commit is contained in:
Leo Franchi
2011-11-16 18:12:35 -05:00
parent c5a50849ec
commit 6dd12f1940

View File

@@ -481,6 +481,14 @@ void
SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
{
bool accept = false;
// Don't highlight the drop for a playlist, as it won't get added to the playlist but created generally
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
event->accept();
return;
}
QTreeView::dragMoveEvent( event );
if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track, DropJob::Append ) )
@@ -550,18 +558,9 @@ SourceTreeView::dropEvent( QDropEvent* event )
qDebug() << Q_FUNC_INFO << "dropType is " << m_delegate->hoveredDropType();
}
// Need to fake the dropevent because the treeview would reject it if it is outside the item (on the tree)
if ( pos.x() < 100 )
{
QDropEvent* newEvent = new QDropEvent( pos + QPoint( 100, 0 ), event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers(), event->type() );
QTreeView::dropEvent( newEvent );
delete newEvent;
}
else
{
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
qDebug() << Q_FUNC_INFO << "Current Event";
DropJob *dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );
@@ -572,6 +571,15 @@ SourceTreeView::dropEvent( QDropEvent* event )
return;
}
// Need to fake the dropevent because the treeview would reject it if it is outside the item (on the tree)
if ( pos.x() < 100 )
{
QDropEvent* newEvent = new QDropEvent( pos + QPoint( 100, 0 ), event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers(), event->type() );
QTreeView::dropEvent( newEvent );
delete newEvent;
}
else
{
QTreeView::dropEvent( event );
}