mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Don't try removing rows when the model is empty.
This commit is contained in:
@@ -47,10 +47,13 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist )
|
|||||||
if ( !m_playlist.isNull() )
|
if ( !m_playlist.isNull() )
|
||||||
disconnect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
disconnect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
||||||
|
|
||||||
emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 );
|
if ( rowCount( QModelIndex() ) )
|
||||||
delete m_rootItem;
|
{
|
||||||
m_rootItem = new PlItem( 0, this );
|
emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 );
|
||||||
emit endRemoveRows();
|
delete m_rootItem;
|
||||||
|
m_rootItem = new PlItem( 0, this );
|
||||||
|
emit endRemoveRows();
|
||||||
|
}
|
||||||
|
|
||||||
m_playlist = playlist;
|
m_playlist = playlist;
|
||||||
connect( playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
connect( playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
||||||
|
Reference in New Issue
Block a user