mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +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:
@@ -827,7 +827,7 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
|
|||||||
{
|
{
|
||||||
case SourcesModel::StaticPlaylist:
|
case SourcesModel::StaticPlaylist:
|
||||||
case SourcesModel::CategoryAdd:
|
case SourcesModel::CategoryAdd:
|
||||||
case SourcesModel::Source: //drop to send tracks to peers
|
case SourcesModel::Source: // drop to send tracks to peers
|
||||||
m_delegate->hovered( index, event->mimeData() );
|
m_delegate->hovered( index, event->mimeData() );
|
||||||
if ( index != m_dropIndex )
|
if ( index != m_dropIndex )
|
||||||
dataChanged( index, index );
|
dataChanged( index, index );
|
||||||
@@ -851,8 +851,10 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
|
|||||||
// Playlists are accepted always since they can be dropped anywhere
|
// Playlists are accepted always since they can be dropped anywhere
|
||||||
//tDebug() << Q_FUNC_INFO << "Accepting";
|
//tDebug() << Q_FUNC_INFO << "Accepting";
|
||||||
event->setDropAction( Qt::CopyAction );
|
event->setDropAction( Qt::CopyAction );
|
||||||
|
m_dropIndex = QPersistentModelIndex( index );
|
||||||
}
|
}
|
||||||
m_dropIndex = QPersistentModelIndex( index );
|
else
|
||||||
|
m_dropIndex = QPersistentModelIndex();
|
||||||
}
|
}
|
||||||
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
|
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
|
||||||
{
|
{
|
||||||
@@ -949,7 +951,8 @@ SourceTreeView::keyPressEvent( QKeyEvent* event )
|
|||||||
void
|
void
|
||||||
SourceTreeView::paintEvent( QPaintEvent* event )
|
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() );
|
QPainter painter( viewport() );
|
||||||
const QRect itemRect = visualRect( m_dropIndex );
|
const QRect itemRect = visualRect( m_dropIndex );
|
||||||
|
Reference in New Issue
Block a user