Public Member Functions | Properties | List of all members
pqTreeView Class Reference

: QTreeView subclass that add ParaView specific customizations. More...

#include <pqTreeView.h>

Inheritance diagram for pqTreeView:
Inheritance graph
[legend]

Public Member Functions

 pqTreeView (QWidget *parent=nullptr, bool use_pqHeaderView=false)
 
 ~pqTreeView () override=default
 
bool eventFilter (QObject *object, QEvent *e) override
 
void wheelEvent (QWheelEvent *event) override
 Overridden to eat wheel events unless this->hasFocus(). More...
 
void setModel (QAbstractItemModel *model) override
 
void setRootIndex (const QModelIndex &index) override
 
QSize sizeHint () const override
 
QSize minimumSizeHint () const override
 
void setMaximumRowCountBeforeScrolling (int val)
 
int maximumRowCountBeforeScrolling () const
 
void setupCustomHeader (bool use_pqHeaderView=false)
 Helper method to change the header type after construction. More...
 

Protected Member Functions

QItemSelectionModel::SelectionFlags selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const override
 We need to change two things about how Qt manages toggling check state of a selected item (see paraview/paraview#18150). More...
 
bool edit (const QModelIndex &index, EditTrigger trigger, QEvent *event) override
 We need to change two things about how Qt manages toggling check state of a selected item (see paraview/paraview#18150). More...
 

Properties

int maximumRowCountBeforeScrolling
 Set the maximum number of rows beyond which this view should show a vertical scroll bar. More...
 

Detailed Description

: QTreeView subclass that add ParaView specific customizations.

pqTreeView adds ParaView specific customizations to the QTreeView. These include the following:

Definition at line 34 of file pqTreeView.h.

Constructor & Destructor Documentation

◆ pqTreeView()

pqTreeView::pqTreeView ( QWidget *  parent = nullptr,
bool  use_pqHeaderView = false 
)

◆ ~pqTreeView()

pqTreeView::~pqTreeView ( )
overridedefault

Member Function Documentation

◆ eventFilter()

bool pqTreeView::eventFilter ( QObject *  object,
QEvent *  e 
)
override

◆ wheelEvent()

void pqTreeView::wheelEvent ( QWheelEvent *  event)
override

Overridden to eat wheel events unless this->hasFocus().

◆ setModel()

void pqTreeView::setModel ( QAbstractItemModel *  model)
override

◆ setRootIndex()

void pqTreeView::setRootIndex ( const QModelIndex &  index)
override

◆ sizeHint()

QSize pqTreeView::sizeHint ( ) const
override

◆ minimumSizeHint()

QSize pqTreeView::minimumSizeHint ( ) const
override

◆ setMaximumRowCountBeforeScrolling()

void pqTreeView::setMaximumRowCountBeforeScrolling ( int  val)
inline

Definition at line 65 of file pqTreeView.h.

◆ maximumRowCountBeforeScrolling()

int pqTreeView::maximumRowCountBeforeScrolling ( ) const
inline

Definition at line 66 of file pqTreeView.h.

◆ setupCustomHeader()

void pqTreeView::setupCustomHeader ( bool  use_pqHeaderView = false)

Helper method to change the header type after construction.

This is useful when pqTreeView is created using a UI file since the optional argument to the constructor cannot be passed easily in that case.

◆ selectionCommand()

QItemSelectionModel::SelectionFlags pqTreeView::selectionCommand ( const QModelIndex &  index,
const QEvent *  event = nullptr 
) const
overrideprotected

We need to change two things about how Qt manages toggling check state of a selected item (see paraview/paraview#18150).

These two overrides help use do that.

First, by overriding selectionCommand, we tell QAbstractItemView to not update selection state in mouse-release. This stops the current selection state being changed when user edits (e.g. toggles check state) of any item.

Second, by override edit, if the edit was triggered because user clicked on a selected item and then toggled its check state, we look at all currently selected checkable items and then set their checkstate to match that of the trigger item.

◆ edit()

bool pqTreeView::edit ( const QModelIndex &  index,
EditTrigger  trigger,
QEvent *  event 
)
overrideprotected

We need to change two things about how Qt manages toggling check state of a selected item (see paraview/paraview#18150).

These two overrides help use do that.

First, by overriding selectionCommand, we tell QAbstractItemView to not update selection state in mouse-release. This stops the current selection state being changed when user edits (e.g. toggles check state) of any item.

Second, by override edit, if the edit was triggered because user clicked on a selected item and then toggled its check state, we look at all currently selected checkable items and then set their checkstate to match that of the trigger item.

Property Documentation

◆ maximumRowCountBeforeScrolling

int pqTreeView::maximumRowCountBeforeScrolling
readwrite

Set the maximum number of rows beyond which this view should show a vertical scroll bar.

The pqTreeView will keep on resizing until maximumRowCountBeforeScrolling row to avoid vertical scrolling.

Definition at line 44 of file pqTreeView.h.


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