1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

Don't paint a hover background during drag & drop, when you can't drop something on a sidebar item, e.g. groups, labels etc.

This commit is contained in:
Christian Muehlhaeuser
2016-02-23 02:15:45 +01:00
parent 285333d43b
commit 2ab9418a9e

View File

@@ -851,9 +851,11 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
// Playlists are accepted always since they can be dropped anywhere
//tDebug() << Q_FUNC_INFO << "Accepting";
event->setDropAction( Qt::CopyAction );
}
m_dropIndex = QPersistentModelIndex( index );
}
else
m_dropIndex = QPersistentModelIndex();
}
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
{
event->setDropAction( Qt::CopyAction );
@@ -949,7 +951,8 @@ SourceTreeView::keyPressEvent( QKeyEvent* event )
void
SourceTreeView::paintEvent( QPaintEvent* event )
{
if ( m_dragging && !m_dropRect.isEmpty() )
/* Draw drag & drop hover background */
if ( m_dragging && !m_dropRect.isEmpty() && m_dropIndex.isValid() )
{
QPainter painter( viewport() );
const QRect itemRect = visualRect( m_dropIndex );