MIRA
Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
TreeViewFilter Class Reference

#include <widgets/TreeViewFilter.h>

Inheritance diagram for TreeViewFilter:
Inheritance graph
[legend]

Public Types

enum  { FilterRole = Qt::UserRole+0x1F }
 

Public Slots

void setAutoHide (bool hide)
 
void showFilter ()
 
void hideFilter ()
 
void useFilterRole (bool use=true)
 Tell this filter to use the special FilterRole of the tree view items to be used for checking if the filter matches. More...
 

Public Member Functions

 TreeViewFilter (QTreeView *view, QWidget *parent=NULL)
 
bool getAutoHide () const
 
void setAlwaysActive (bool always)
 If set to true, the filter will stay active as long as its filter string is not empty, i.e. More...
 
void setExpandAll (bool expandAll)
 If set to true, all (visible) nodes in the tree will be always expanded. More...
 
void setShowChildren (bool show)
 If set to true, the children of items matching the entered filter will be visible, otherwise hidden. More...
 
void setExpandChildren (bool expand)
 If set to true, the children of items matching the entered filter (if visible) will be expanded automatically. More...
 
void setFilterColumns (const std::vector< int > &cols)
 Specifies the columns that are used for testing if the pattern matches. More...
 
void setFilterColumns (int col1)
 
void setFilterColumns (int col1, int col2)
 
void setFilterColumns (int col1, int col2, int col3)
 
void clearFilter ()
 Clear the filter text. More...
 

Protected Member Functions

virtual void timerEvent (QTimerEvent *)
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FilterRole 

Constructor & Destructor Documentation

◆ TreeViewFilter()

TreeViewFilter ( QTreeView *  view,
QWidget *  parent = NULL 
)

Member Function Documentation

◆ timerEvent()

virtual void timerEvent ( QTimerEvent *  )
protectedvirtual

◆ setAutoHide

void setAutoHide ( bool  hide)
slot

◆ showFilter

void showFilter ( )
slot

◆ hideFilter

void hideFilter ( )
slot

◆ useFilterRole

void useFilterRole ( bool  use = true)
slot

Tell this filter to use the special FilterRole of the tree view items to be used for checking if the filter matches.

By default the text of the DisplayRole is used (which e.g. can be set via item->setText(...)). However, sometimes it is desirable to do the filtering based on a different text or for a subset of the items only. In this case, this method can be called to enable a different mode, which only checks those items, where the special FilterRole is specified and where the text of this FilterRole matches the filter. To specify a FilterRole text, e.g. use

item->setData(column, (Qt::ItemDataRole)TreeViewFilter::FilterRole, text);

The FilterRole value is specified by this class.

◆ getAutoHide()

bool getAutoHide ( ) const

◆ setAlwaysActive()

void setAlwaysActive ( bool  always)

If set to true, the filter will stay active as long as its filter string is not empty, i.e.

it will filter frequently at a fixed interval, thus also applying to updated content. (default: false)

◆ setExpandAll()

void setExpandAll ( bool  expandAll)

If set to true, all (visible) nodes in the tree will be always expanded.

Otherwise, only matching nodes from an active filter will be expanded. (default: false)

◆ setShowChildren()

void setShowChildren ( bool  show)

If set to true, the children of items matching the entered filter will be visible, otherwise hidden.

(default: true).

◆ setExpandChildren()

void setExpandChildren ( bool  expand)

If set to true, the children of items matching the entered filter (if visible) will be expanded automatically.

(default: true).

◆ setFilterColumns() [1/4]

void setFilterColumns ( const std::vector< int > &  cols)

Specifies the columns that are used for testing if the pattern matches.

(default: all columns)

If an empty vector is passed, all columns are used for filtering.

◆ setFilterColumns() [2/4]

void setFilterColumns ( int  col1)

◆ setFilterColumns() [3/4]

void setFilterColumns ( int  col1,
int  col2 
)

◆ setFilterColumns() [4/4]

void setFilterColumns ( int  col1,
int  col2,
int  col3 
)

◆ clearFilter()

void clearFilter ( )

Clear the filter text.


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