pqHeaderView extends QHeaderView to add support for Qt::CheckStateRole. More...
#include <pqHeaderView.h>
Inherits QHeaderView.
Signals | |
void | customIndicatorClicked (int section, const QPoint &pt, const QString &role) |
Public Member Functions | |
pqHeaderView (Qt::Orientation orientation, QWidget *parent=nullptr) | |
~pqHeaderView () override | |
QRect | lastCheckRect () const |
For testing purposes only. More... | |
void | setToggleCheckStateOnSectionClick (bool val) |
For checkable section, this property controls if clicks on the entire section should be treated as a request to toggle the check state or only limit the click to the checkbox. More... | |
bool | toggleCheckStateOnSectionClick () const |
For checkable section, this property controls if clicks on the entire section should be treated as a request to toggle the check state or only limit the click to the checkbox. More... | |
bool | isCustomIndicatorShown () const |
This property holds if a custom indicator is shown for sections. More... | |
void | setCustomIndicatorShown (bool val) |
This property holds if a custom indicator is shown for sections. More... | |
void | addCustomIndicatorIcon (const QIcon &icon, const QString &role) |
When showCustomIndicator property is true, these are the icons rendered. More... | |
void | removeCustomIndicatorIcon (const QString &role) |
When showCustomIndicator property is true, these are the icons rendered. More... | |
QIcon | customIndicatorIcon (const QString &role) const |
When showCustomIndicator property is true, these are the icons rendered. More... | |
Protected Member Functions | |
void | paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
Properties | |
bool | showCustomIndicator |
pqHeaderView extends QHeaderView to add support for Qt::CheckStateRole.
pqHeaderView extends QHeaderView to add support for getting and setting Qt::CheckStateRole. The QAbstractItemModel connected to the view must support getting/setting check state by providing appropriate implementations for QAbstractItemModel::setHeaderData
and QAbstractItemModel::headerData
.
This class is a reimplementation of pqCheckableHeaderView with improved rendering as well as letting the model handle getting and setting of header check state via the header-data API.
Currently, pqHeaderView is only intended to be used for horizontal headers. However, it should be fairly straight forward to support vertical headers, if needed.
Definition at line 33 of file pqHeaderView.h.
pqHeaderView::pqHeaderView | ( | Qt::Orientation | orientation, |
QWidget * | parent = nullptr |
||
) |
|
override |
|
inline |
For checkable section, this property controls if clicks on the entire section should be treated as a request to toggle the check state or only limit the click to the checkbox.
Default is to limit to the checkbox, set to true if you want the entire section respond to clicks as toggling the check state.
Definition at line 51 of file pqHeaderView.h.
|
inline |
For checkable section, this property controls if clicks on the entire section should be treated as a request to toggle the check state or only limit the click to the checkbox.
Default is to limit to the checkbox, set to true if you want the entire section respond to clicks as toggling the check state.
Definition at line 52 of file pqHeaderView.h.
|
inline |
This property holds if a custom indicator is shown for sections.
The custom indicator can be used to popup a custom menu or filtering options, for example. If enabled, all visible sections with non-empty header data get a custom indicator rendered.
By default, this property is false
.
Definition at line 64 of file pqHeaderView.h.
void pqHeaderView::setCustomIndicatorShown | ( | bool | val | ) |
This property holds if a custom indicator is shown for sections.
The custom indicator can be used to popup a custom menu or filtering options, for example. If enabled, all visible sections with non-empty header data get a custom indicator rendered.
By default, this property is false
.
When showCustomIndicator
property is true, these are the icons rendered.
Icons are rendered in order from right to left i.e. first added icon on the rightmost side and so on. The role
is useful in distinguishing user clicks when the customIndicatorClicked
signal is fired.
void pqHeaderView::removeCustomIndicatorIcon | ( | const QString & | role | ) |
When showCustomIndicator
property is true, these are the icons rendered.
Icons are rendered in order from right to left i.e. first added icon on the rightmost side and so on. The role
is useful in distinguishing user clicks when the customIndicatorClicked
signal is fired.
QIcon pqHeaderView::customIndicatorIcon | ( | const QString & | role | ) | const |
When showCustomIndicator
property is true, these are the icons rendered.
Icons are rendered in order from right to left i.e. first added icon on the rightmost side and so on. The role
is useful in distinguishing user clicks when the customIndicatorClicked
signal is fired.
|
inline |
For testing purposes only.
Returns the position of the painted checkbox in the most recent paint call. Note, currently we only support at most one checkable section. We will need to change this API if we start supporting multiple checkable sections.
Definition at line 87 of file pqHeaderView.h.
|
signal |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
readwrite |
Definition at line 37 of file pqHeaderView.h.