1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 14:46:33 +02:00

* PlayableProxyModel can now hide empty parent nodes when needed.

This commit is contained in:
Christian Muehlhaeuser
2014-08-13 01:05:55 +02:00
parent 564c8ab1a2
commit f6b9a2e761
2 changed files with 10 additions and 0 deletions

View File

@@ -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;

View File

@@ -115,6 +115,7 @@ private:
PlayableModel* m_model;
bool m_showOfflineResults;
bool m_hideEmptyParents;
bool m_hideDupeItems;
int m_maxVisibleItems;