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

Show drop indicator after last track if it's dropped below

This commit is contained in:
Leo Franchi 2011-08-05 14:22:34 -04:00
parent b67623e649
commit c7c12eef93

View File

@ -241,7 +241,14 @@ TrackView::dragMoveEvent( QDragMoveEvent* event )
{
setDirtyRegion( m_dropRect );
const QPoint pos = event->pos();
const QModelIndex index = indexAt( pos );
QModelIndex index = indexAt( pos );
bool pastLast = false;
if ( !index.isValid() && proxyModel()->rowCount( QModelIndex() ) > 0 )
{
index = proxyModel()->index( proxyModel()->rowCount( QModelIndex() ) - 1, 0, QModelIndex() );
pastLast = true;
}
if ( index.isValid() )
{
@ -250,7 +257,8 @@ TrackView::dragMoveEvent( QDragMoveEvent* event )
// indicate that the item will be inserted above the current place
const int gap = 5; // FIXME constant
m_dropRect = QRect( 0, rect.top() - gap / 2, width(), gap );
int yHeight = ( pastLast ? rect.bottom() : rect.top() ) - gap / 2;
m_dropRect = QRect( 0, yHeight, width(), gap );
event->acceptProposedAction();
}