Public Member Functions | Protected Slots | 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 &)
 

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 64 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 80 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 81 of file pqTreeViewSelectionHelper.h.

◆ showContextMenu

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

Property Documentation

◆ filterable

bool pqTreeViewSelectionHelper::filterable
readwrite

Definition at line 68 of file pqTreeViewSelectionHelper.h.


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