InfixFilterModel Class Reference

This proxy model reimplements the filterAcceptsRow function with a new behavior: All elements that fit the filter string are shown alongside with all their parents as well as all their children. More...

#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/InfixFilterModel.h>

+ Inheritance diagram for InfixFilterModel:

Public Types

using FilterFunc = std::function< bool(QAbstractItemModel *, int, const QModelIndex &)>
 

Public Member Functions

void addCustomFilter (FilterFunc function)
 
 InfixFilterModel (QObject *parent=0)
 

Static Public Member Functions

static bool containsAll (const QString &text, const QStringList &searchParts)
 
static void ExpandFilterResults (QTreeView *treeView)
 Expands the treeview that all items that match the filterstring are expanded and directly visible. More...
 

Protected Member Functions

bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent, bool considerParents) const
 

Protected Attributes

std::vector< FilterFunccustomFilters
 

Detailed Description

This proxy model reimplements the filterAcceptsRow function with a new behavior: All elements that fit the filter string are shown alongside with all their parents as well as all their children.

This means the full sub-tree which contains matching elements is shown.

Definition at line 41 of file InfixFilterModel.h.

Member Typedef Documentation

◆ FilterFunc

using FilterFunc = std::function<bool(QAbstractItemModel*, int, const QModelIndex&)>

Definition at line 46 of file InfixFilterModel.h.

Constructor & Destructor Documentation

◆ InfixFilterModel()

InfixFilterModel ( QObject *  parent = 0)

Definition at line 32 of file InfixFilterModel.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomFilter()

void addCustomFilter ( InfixFilterModel::FilterFunc  function)

Definition at line 58 of file InfixFilterModel.cpp.

+ Here is the caller graph for this function:

◆ containsAll()

bool containsAll ( const QString &  text,
const QStringList &  searchParts 
)
static

Definition at line 46 of file InfixFilterModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExpandFilterResults()

void ExpandFilterResults ( QTreeView *  treeView)
static

Expands the treeview that all items that match the filterstring are expanded and directly visible.

Anything else is collapsed.

Parameters
treeView

Definition at line 63 of file InfixFilterModel.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filterAcceptsRow() [1/2]

bool filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
overrideprotected

Definition at line 109 of file InfixFilterModel.cpp.

+ Here is the caller graph for this function:

◆ filterAcceptsRow() [2/2]

bool filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent,
bool  considerParents 
) const
protected

Definition at line 114 of file InfixFilterModel.cpp.

Member Data Documentation

◆ customFilters

std::vector<FilterFunc> customFilters
protected

Definition at line 60 of file InfixFilterModel.h.


The documentation for this class was generated from the following files: