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 |
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.
pqTreeViewSelectionHelper::pqTreeViewSelectionHelper | ( | QAbstractItemView * | view, |
bool | customIndicator = true |
||
) |
|
override |
|
inline |
This property holds whether the tree view support filtering.
By default, this property is true.
Definition at line 52 of file pqTreeViewSelectionHelper.h.
|
inline |
This property holds whether the tree view support filtering.
By default, this property is true.
Definition at line 53 of file pqTreeViewSelectionHelper.h.
|
protectedvirtual |
|
protectedvirtualslot |
|
protected |
Definition at line 58 of file pqTreeViewSelectionHelper.h.
|
readwrite |
Definition at line 40 of file pqTreeViewSelectionHelper.h.