Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
pqHeaderView Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ pqHeaderView()

pqHeaderView::pqHeaderView ( Qt::Orientation  orientation,
QWidget *  parent = nullptr 
)

◆ ~pqHeaderView()

pqHeaderView::~pqHeaderView ( )
override

Member Function Documentation

◆ setToggleCheckStateOnSectionClick()

void pqHeaderView::setToggleCheckStateOnSectionClick ( bool  val)
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.

◆ toggleCheckStateOnSectionClick()

bool pqHeaderView::toggleCheckStateOnSectionClick ( ) const
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.

◆ isCustomIndicatorShown()

bool pqHeaderView::isCustomIndicatorShown ( ) const
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.

◆ setCustomIndicatorShown()

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.

◆ addCustomIndicatorIcon()

void pqHeaderView::addCustomIndicatorIcon ( const QIcon &  icon,
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.

◆ removeCustomIndicatorIcon()

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.

◆ customIndicatorIcon()

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.

◆ lastCheckRect()

QRect pqHeaderView::lastCheckRect ( ) const
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.

◆ customIndicatorClicked

void pqHeaderView::customIndicatorClicked ( int  section,
const QPoint &  pt,
const QString &  role 
)
signal

◆ paintSection()

void pqHeaderView::paintSection ( QPainter *  painter,
const QRect &  rect,
int  logicalIndex 
) const
overrideprotected

◆ mousePressEvent()

void pqHeaderView::mousePressEvent ( QMouseEvent *  event)
overrideprotected

◆ mouseReleaseEvent()

void pqHeaderView::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Property Documentation

◆ showCustomIndicator

bool pqHeaderView::showCustomIndicator
readwrite

Definition at line 37 of file pqHeaderView.h.


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