1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 12:31:52 +02:00

* Show correct artist/album/track pixmap when dragging from a GridView.

This commit is contained in:
Christian Muehlhaeuser 2014-09-09 00:03:19 +02:00
parent 63e6238f4e
commit f546d744db
2 changed files with 10 additions and 3 deletions

View File

@ -360,7 +360,15 @@ GridView::startDrag( Qt::DropActions supportedActions )
QDrag* drag = new QDrag( this );
drag->setMimeData( data );
const QPixmap p = TomahawkUtils::createDragPixmap( TomahawkUtils::MediaTypeAlbum, indexes.count() );
QPixmap p;
if ( data->hasFormat( "application/tomahawk.metadata.artist" ) )
p = TomahawkUtils::createDragPixmap( TomahawkUtils::MediaTypeArtist, indexes.count() );
else if ( data->hasFormat( "application/tomahawk.metadata.album" ) )
p = TomahawkUtils::createDragPixmap( TomahawkUtils::MediaTypeAlbum, indexes.count() );
else
p = TomahawkUtils::createDragPixmap( TomahawkUtils::MediaTypeTrack, indexes.count() );
drag->setPixmap( p );
drag->setHotSpot( QPoint( -20, -20 ) );

View File

@ -80,7 +80,7 @@ createDragPixmap( MediaType type, int itemCount )
xCount = 5;
size = 16;
}
else if( itemCount > 9 )
else if ( itemCount > 9 )
{
xCount = 4;
size = 22;
@ -125,7 +125,6 @@ createDragPixmap( MediaType type, int itemCount )
int y = 0;
for ( int i = 0; i < itemCount; ++i )
{
painter.drawPixmap( x, y, pixmap );
x += size + 1;