From dcaa6ef8d762cf8202ebdad8865f5c77e3fe4d90 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 26 May 2013 21:38:46 +0200 Subject: [PATCH] * CreateIndex isn't the right place to connect signals. --- src/libtomahawk/playlist/PlayableModel.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libtomahawk/playlist/PlayableModel.cpp b/src/libtomahawk/playlist/PlayableModel.cpp index 4ccb20b7a..a8ccb74b3 100644 --- a/src/libtomahawk/playlist/PlayableModel.cpp +++ b/src/libtomahawk/playlist/PlayableModel.cpp @@ -62,12 +62,6 @@ PlayableModel::~PlayableModel() QModelIndex PlayableModel::createIndex( int row, int column, PlayableItem* item ) const { - if ( item->query() ) - { - connect( item->query().data(), SIGNAL( playableStateChanged( bool ) ), SLOT( onQueryBecamePlayable( bool ) ), Qt::UniqueConnection ); - connect( item->query().data(), SIGNAL( resolvingFinished( bool ) ), SLOT( onQueryResolved( bool ) ), Qt::UniqueConnection ); - } - return QAbstractItemModel::createIndex( row, column, item ); } @@ -608,6 +602,11 @@ PlayableModel::insertInternal( const QList< T >& items, int row, const QList< To { plitem = new PlayableItem( item, m_rootItem, row + i ); plitem->index = createIndex( row + i, 0, plitem ); + if ( item->query() ) + { + connect( item->query().data(), SIGNAL( playableStateChanged( bool ) ), SLOT( onQueryBecamePlayable( bool ) ), Qt::UniqueConnection ); + connect( item->query().data(), SIGNAL( resolvingFinished( bool ) ), SLOT( onQueryResolved( bool ) ), Qt::UniqueConnection ); + } if ( logs.count() > i ) plitem->setPlaybackLog( logs.at( i ) );