mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
* Reset PlayableModel's currentIndex when it gets removed from the model.
This commit is contained in:
parent
3823774dca
commit
96b9f38b2e
@ -312,7 +312,7 @@ PlayableModel::headerData( int section, Qt::Orientation orientation, int role )
|
||||
|
||||
|
||||
void
|
||||
PlayableModel::setCurrentItem( const QModelIndex& index )
|
||||
PlayableModel::setCurrentIndex( const QModelIndex& index )
|
||||
{
|
||||
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||
if ( oldEntry )
|
||||
@ -332,6 +332,8 @@ PlayableModel::setCurrentItem( const QModelIndex& index )
|
||||
m_currentIndex = QModelIndex();
|
||||
m_currentUuid = QString();
|
||||
}
|
||||
|
||||
emit currentIndexChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -596,6 +598,9 @@ PlayableModel::removeIndex( const QModelIndex& index, bool moreToCome )
|
||||
PlayableItem* item = itemFromIndex( index );
|
||||
if ( item )
|
||||
{
|
||||
if ( index == m_currentIndex )
|
||||
setCurrentIndex( QModelIndex() );
|
||||
|
||||
emit beginRemoveRows( index.parent(), index.row(), index.row() );
|
||||
delete item;
|
||||
emit endRemoveRows();
|
||||
|
@ -123,8 +123,10 @@ signals:
|
||||
void indexPlayable( const QModelIndex& index );
|
||||
void changed();
|
||||
|
||||
void currentIndexChanged();
|
||||
|
||||
public slots:
|
||||
virtual void setCurrentItem( const QModelIndex& index );
|
||||
virtual void setCurrentIndex( const QModelIndex& index );
|
||||
|
||||
virtual void clear();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user