mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
* PlayableProxyModel can now hide empty parent nodes when needed.
This commit is contained in:
parent
564c8ab1a2
commit
f6b9a2e761
@ -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;
|
||||
|
||||
|
@ -115,6 +115,7 @@ private:
|
||||
PlayableModel* m_model;
|
||||
|
||||
bool m_showOfflineResults;
|
||||
bool m_hideEmptyParents;
|
||||
bool m_hideDupeItems;
|
||||
int m_maxVisibleItems;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user