Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
pqTreeViewSelectionHelper Class Reference

helper class to add selection/sort/filter context menu to QAbstractItemView. More...

#include <pqTreeViewSelectionHelper.h>

Inherits QObject.

Public Member Functions

 pqTreeViewSelectionHelper (QAbstractItemView *view, bool customIndicator=true)
 
 ~pqTreeViewSelectionHelper () override
 
bool isFilterable () const
 This property holds whether the tree view support filtering. More...
 
void setFilterable (bool val)
 This property holds whether the tree view support filtering. More...
 

Protected Slots

virtual void showContextMenu (int section, const QPoint &)
 

Protected Member Functions

virtual void buildupMenu (QMenu &menu, int section, const QPoint &pos)
 

Protected Attributes

QAbstractItemView * TreeView
 

Properties

bool filterable
 

Detailed Description

helper class to add selection/sort/filter context menu to QAbstractItemView.

pqTreeViewSelectionHelper is used to add a custom context menu to QAbstractItemView to do common actions such as checking/unchecking highlighted items, sorting, and filtering.

If the QAbstractItemView has a pqHeaderView as the header then this class calls pqHeaderView::setCustomIndicatorIcon and also shows the context menu when the custom indicator icon is clicked in the header.

Sorting and filtering options are added to the context menu only if the model associated with the tree view is QSortFilterProxyModel or subclass.

Filtering can be enabled/disabled using the filterable property. Default is enabled. When enabling filtering for a tree view where the tree is more than 1 level deep, keep in mind that you may need to enable recursiveFilteringEnabled on QSortFilterProxyModel (supported in Qt 5.10 and later) to ensure that the filtering correctly traverses the tree. For older Qt versions, it's recommended that you disable filtering support for non-flat trees using pqTreeViewSelectionHelper::setFilterable(false).

Definition at line 36 of file pqTreeViewSelectionHelper.h.

Constructor & Destructor Documentation

◆ pqTreeViewSelectionHelper()

pqTreeViewSelectionHelper::pqTreeViewSelectionHelper ( QAbstractItemView *  view,
bool  customIndicator = true 
)

◆ ~pqTreeViewSelectionHelper()

pqTreeViewSelectionHelper::~pqTreeViewSelectionHelper ( )
override

Member Function Documentation

◆ isFilterable()

bool pqTreeViewSelectionHelper::isFilterable ( ) const
inline

This property holds whether the tree view support filtering.

By default, this property is true.

Definition at line 52 of file pqTreeViewSelectionHelper.h.

◆ setFilterable()

void pqTreeViewSelectionHelper::setFilterable ( bool  val)
inline

This property holds whether the tree view support filtering.

By default, this property is true.

Definition at line 53 of file pqTreeViewSelectionHelper.h.

◆ buildupMenu()

virtual void pqTreeViewSelectionHelper::buildupMenu ( QMenu &  menu,
int  section,
const QPoint &  pos 
)
protectedvirtual

◆ showContextMenu

virtual void pqTreeViewSelectionHelper::showContextMenu ( int  section,
const QPoint &   
)
protectedvirtualslot

Member Data Documentation

◆ TreeView

QAbstractItemView* pqTreeViewSelectionHelper::TreeView
protected

Definition at line 58 of file pqTreeViewSelectionHelper.h.

Property Documentation

◆ filterable

bool pqTreeViewSelectionHelper::filterable
readwrite

Definition at line 40 of file pqTreeViewSelectionHelper.h.


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