From 84faa1671c3ef3b9493a03b479cef398a14d51c9 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 1fed2226b..148d22744 100644 --- a/src/libtomahawk/playlist/PlayableModel.cpp +++ b/src/libtomahawk/playlist/PlayableModel.cpp @@ -69,12 +69,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 ); } @@ -635,6 +629,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 ) );