diff --git a/src/libtomahawk/playlist/PlayableProxyModel.cpp b/src/libtomahawk/playlist/PlayableProxyModel.cpp index 8db77822c..823f1f5f9 100644 --- a/src/libtomahawk/playlist/PlayableProxyModel.cpp +++ b/src/libtomahawk/playlist/PlayableProxyModel.cpp @@ -35,6 +35,7 @@ PlayableProxyModel::PlayableProxyModel( QObject* parent ) : QSortFilterProxyModel( parent ) , m_model( 0 ) , m_showOfflineResults( true ) + , m_hideEmptyParents( true ) , m_hideDupeItems( false ) , m_maxVisibleItems( -1 ) , m_style( Detailed ) @@ -136,6 +137,14 @@ PlayableProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourcePa if ( !pi ) return false; + if ( m_hideEmptyParents && pi->source() ) + { + if ( !sourceModel()->rowCount( sourceModel()->index( sourceRow, 0, sourceParent ) ) ) + { + return false; + } + } + if ( m_maxVisibleItems > 0 && sourceRow > m_maxVisibleItems - 1 ) return false; diff --git a/src/libtomahawk/playlist/PlayableProxyModel.h b/src/libtomahawk/playlist/PlayableProxyModel.h index db024337b..c02f806b3 100644 --- a/src/libtomahawk/playlist/PlayableProxyModel.h +++ b/src/libtomahawk/playlist/PlayableProxyModel.h @@ -115,6 +115,7 @@ private: PlayableModel* m_model; bool m_showOfflineResults; + bool m_hideEmptyParents; bool m_hideDupeItems; int m_maxVisibleItems;