mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-18 11:45:04 -04:00
ResourceModel: implement filter functionality
So far all subclasses implemented filtering on their own which doesn't make much sense. Now one can set filter keywords and a filter type for all ResourceModels. Subclasses simply have to call ResourceModel::itemMatchesFilter( ResourceItem ) in order to determine whether an item should be hidden or not. Additionally they have to implement the updateFilters() method in order to update their internal management data each time the filters change.
This commit is contained in:
@@ -36,20 +36,19 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
int rowCount( const QModelIndex & _parent = QModelIndex() ) const;
|
||||
virtual int rowCount( const QModelIndex & _parent = QModelIndex() ) const;
|
||||
|
||||
virtual QModelIndex index( int _row, int _col,
|
||||
const QModelIndex & _parent = QModelIndex() ) const;
|
||||
|
||||
virtual QModelIndex parent( const QModelIndex & _index ) const;
|
||||
|
||||
virtual void setFilter( const QString & _s );
|
||||
virtual void updateFilters();
|
||||
|
||||
|
||||
private:
|
||||
bool filterItems( ResourceItem::Relation * _item,
|
||||
const QModelIndex & _parent,
|
||||
const QStringList & _keywords );
|
||||
const QModelIndex & _parent );
|
||||
void setHidden( ResourceItem::Relation * _item,
|
||||
const QModelIndex & _parent,
|
||||
bool _hidden,
|
||||
|
||||
Reference in New Issue
Block a user