Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
pqFlatTreeView Class Reference

The pqFlatTreeView class is used to display a flattened tree view of a hierarchical model. More...

#include <pqFlatTreeView.h>

Inheritance diagram for pqFlatTreeView:
Inheritance graph
[legend]

Public Types

enum  SelectionBehavior { SelectItems, SelectRows, SelectColumns }
 
enum  SelectionMode { NoSelection, SingleSelection, ExtendedSelection }
 

Public Slots

void reset ()
 
void selectAll ()
 
void setCurrentIndex (const QModelIndex &index)
 
void expandAll ()
 
void expand (const QModelIndex &index)
 
void collapse (const QModelIndex &index)
 
void scrollTo (const QModelIndex &index)
 

Signals

void activated (const QModelIndex &index)
 
void clicked (const QModelIndex &index)
 

Public Member Functions

 pqFlatTreeView (QWidget *parent=nullptr)
 Creates a flat tree view. More...
 
 ~pqFlatTreeView () override
 
bool eventFilter (QObject *object, QEvent *e) override
 Used to monitor the header view. More...
 
Model Setup Methods
QAbstractItemModel * getModel () const
 
void setModel (QAbstractItemModel *model)
 
QModelIndex getRootIndex () const
 
void setRootIndex (const QModelIndex &index)
 
Selection Setup Methods
QItemSelectionModel * getSelectionModel () const
 
void setSelectionModel (QItemSelectionModel *selectionModel)
 
SelectionBehavior getSelectionBehavior () const
 
void setSelectionBehavior (SelectionBehavior behavior)
 
SelectionMode getSelectionMode () const
 
void setSelectionMode (SelectionMode mode)
 
Column Management Methods
QHeaderView * getHeader () const
 Gets whether or not the column size is managed by the view. More...
 
void setHeader (QHeaderView *headerView)
 Gets whether or not the column size is managed by the view. More...
 
bool isColumnSizeManaged () const
 Gets whether or not the column size is managed by the view. More...
 
void setColumnSizeManaged (bool managed)
 Sets whether or not the column size is managed by the view. More...
 
Drawing Options
int getIconSize () const
 
void setIconSize (int iconSize)
 
Index Location Methods
bool isIndexHidden (const QModelIndex &index) const
 
void getVisibleRect (const QModelIndex &index, QRect &area) const
 
QModelIndex getIndexVisibleAt (const QPoint &point) const
 
QModelIndex getIndexCellAt (const QPoint &point) const
 
void getSelectionIn (const QRect &rect, QItemSelection &items) const
 
Index Navigation Methods
bool isIndexExpanded (const QModelIndex &index) const
 
QModelIndex getNextVisibleIndex (const QModelIndex &index, const QModelIndex &root=QModelIndex()) const
 
QModelIndex getRelativeIndex (const QString &id, const QModelIndex &root=QModelIndex()) const
 
void getRelativeIndexId (const QModelIndex &index, QString &id, const QModelIndex &root=QModelIndex()) const
 
Editing Methods
bool startEditing (const QModelIndex &index)
 
void finishEditing ()
 
void cancelEditing ()
 

Protected Slots

Model Change Handlers
void insertRows (const QModelIndex &parent, int start, int end)
 
void startRowRemoval (const QModelIndex &parent, int start, int end)
 
void finishRowRemoval (const QModelIndex &parent, int start, int end)
 
void insertColumns (const QModelIndex &parent, int start, int end)
 
void startColumnRemoval (const QModelIndex &parent, int start, int end)
 
void finishColumnRemoval (const QModelIndex &parent, int start, int end)
 
void updateData (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 

Protected Member Functions

int horizontalOffset () const
 
int verticalOffset () const
 
void resizeEvent (QResizeEvent *e) override
 
bool viewportEvent (QEvent *e) override
 
void paintEvent (QPaintEvent *e) override
 
QStyleOptionViewItem getViewOptions () const
 
Keyboard Event Handlers
void keyPressEvent (QKeyEvent *e) override
 
void keyboardSearch (const QString &search)
 
Mouse Event Handlers
void mousePressEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void mouseDoubleClickEvent (QMouseEvent *e) override
 
Event Handlers
bool event (QEvent *e) override
 

Detailed Description

The pqFlatTreeView class is used to display a flattened tree view of a hierarchical model.

The tree view is flattened by taking long indented chains of single items and lining them up vertically. If an item is the only descendant of its parent item, it is drawn directly below its parent. A vertical branch is drawn between the items to indicate relationship. If an item has more than one descendant, those items are indented from the parent. Normal tree view branches are drawn between the parent and child items to show the relationship.

Definition at line 46 of file pqFlatTreeView.h.

Member Enumeration Documentation

◆ SelectionBehavior

Enumerator
SelectItems 
SelectRows 
SelectColumns 

Definition at line 51 of file pqFlatTreeView.h.

◆ SelectionMode

Enumerator
NoSelection 
SingleSelection 
ExtendedSelection 

Definition at line 58 of file pqFlatTreeView.h.

Constructor & Destructor Documentation

◆ pqFlatTreeView()

pqFlatTreeView::pqFlatTreeView ( QWidget *  parent = nullptr)

Creates a flat tree view.

Parameters
parentThe parent widget for this instance.

◆ ~pqFlatTreeView()

pqFlatTreeView::~pqFlatTreeView ( )
override

Member Function Documentation

◆ eventFilter()

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

Used to monitor the header view.

When the header view is shown or hidden, the layout needs to be updated and repainted.

Parameters
objectThe object which will receive the event.
eThe event to be sent.

◆ getModel()

QAbstractItemModel* pqFlatTreeView::getModel ( ) const
inline

Definition at line 89 of file pqFlatTreeView.h.

◆ setModel()

void pqFlatTreeView::setModel ( QAbstractItemModel *  model)

◆ getRootIndex()

QModelIndex pqFlatTreeView::getRootIndex ( ) const

◆ setRootIndex()

void pqFlatTreeView::setRootIndex ( const QModelIndex &  index)

◆ getSelectionModel()

QItemSelectionModel* pqFlatTreeView::getSelectionModel ( ) const
inline

Definition at line 100 of file pqFlatTreeView.h.

◆ setSelectionModel()

void pqFlatTreeView::setSelectionModel ( QItemSelectionModel *  selectionModel)

◆ getSelectionBehavior()

SelectionBehavior pqFlatTreeView::getSelectionBehavior ( ) const
inline

Definition at line 103 of file pqFlatTreeView.h.

◆ setSelectionBehavior()

void pqFlatTreeView::setSelectionBehavior ( SelectionBehavior  behavior)

◆ getSelectionMode()

SelectionMode pqFlatTreeView::getSelectionMode ( ) const
inline

Definition at line 106 of file pqFlatTreeView.h.

◆ setSelectionMode()

void pqFlatTreeView::setSelectionMode ( SelectionMode  mode)

◆ getHeader()

QHeaderView* pqFlatTreeView::getHeader ( ) const
inline

Gets whether or not the column size is managed by the view.

Column size management is on by default and used when the view header is hidden. When size management is on, the columns will be resized to fit the model data in the column.

Returns
True if the column size is managed by the view.

Definition at line 114 of file pqFlatTreeView.h.

◆ setHeader()

void pqFlatTreeView::setHeader ( QHeaderView *  headerView)

Gets whether or not the column size is managed by the view.

Column size management is on by default and used when the view header is hidden. When size management is on, the columns will be resized to fit the model data in the column.

Returns
True if the column size is managed by the view.

◆ isColumnSizeManaged()

bool pqFlatTreeView::isColumnSizeManaged ( ) const
inline

Gets whether or not the column size is managed by the view.

Column size management is on by default and used when the view header is hidden. When size management is on, the columns will be resized to fit the model data in the column.

Returns
True if the column size is managed by the view.

Definition at line 128 of file pqFlatTreeView.h.

◆ setColumnSizeManaged()

void pqFlatTreeView::setColumnSizeManaged ( bool  managed)

Sets whether or not the column size is managed by the view.

Parameters
managedTrue if the column size should be managed.
See also
pqFlatTreeView::isColumnSizeManaged()

◆ getIconSize()

int pqFlatTreeView::getIconSize ( ) const

◆ setIconSize()

void pqFlatTreeView::setIconSize ( int  iconSize)

◆ isIndexHidden()

bool pqFlatTreeView::isIndexHidden ( const QModelIndex &  index) const

◆ getVisibleRect()

void pqFlatTreeView::getVisibleRect ( const QModelIndex &  index,
QRect &  area 
) const

◆ getIndexVisibleAt()

QModelIndex pqFlatTreeView::getIndexVisibleAt ( const QPoint &  point) const

◆ getIndexCellAt()

QModelIndex pqFlatTreeView::getIndexCellAt ( const QPoint &  point) const

◆ getSelectionIn()

void pqFlatTreeView::getSelectionIn ( const QRect &  rect,
QItemSelection &  items 
) const

◆ isIndexExpanded()

bool pqFlatTreeView::isIndexExpanded ( const QModelIndex &  index) const

◆ getNextVisibleIndex()

QModelIndex pqFlatTreeView::getNextVisibleIndex ( const QModelIndex &  index,
const QModelIndex &  root = QModelIndex() 
) const

◆ getRelativeIndex()

QModelIndex pqFlatTreeView::getRelativeIndex ( const QString &  id,
const QModelIndex &  root = QModelIndex() 
) const

◆ getRelativeIndexId()

void pqFlatTreeView::getRelativeIndexId ( const QModelIndex &  index,
QString &  id,
const QModelIndex &  root = QModelIndex() 
) const

◆ startEditing()

bool pqFlatTreeView::startEditing ( const QModelIndex &  index)

◆ finishEditing()

void pqFlatTreeView::finishEditing ( )

◆ cancelEditing()

void pqFlatTreeView::cancelEditing ( )

◆ activated

void pqFlatTreeView::activated ( const QModelIndex &  index)
signal

◆ clicked

void pqFlatTreeView::clicked ( const QModelIndex &  index)
signal

◆ reset

void pqFlatTreeView::reset ( )
slot

◆ selectAll

void pqFlatTreeView::selectAll ( )
slot

◆ setCurrentIndex

void pqFlatTreeView::setCurrentIndex ( const QModelIndex &  index)
slot

◆ expandAll

void pqFlatTreeView::expandAll ( )
slot

◆ expand

void pqFlatTreeView::expand ( const QModelIndex &  index)
slot

◆ collapse

void pqFlatTreeView::collapse ( const QModelIndex &  index)
slot

◆ scrollTo

void pqFlatTreeView::scrollTo ( const QModelIndex &  index)
slot

◆ insertRows

void pqFlatTreeView::insertRows ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ startRowRemoval

void pqFlatTreeView::startRowRemoval ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ finishRowRemoval

void pqFlatTreeView::finishRowRemoval ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ insertColumns

void pqFlatTreeView::insertColumns ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ startColumnRemoval

void pqFlatTreeView::startColumnRemoval ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ finishColumnRemoval

void pqFlatTreeView::finishColumnRemoval ( const QModelIndex &  parent,
int  start,
int  end 
)
protectedslot

◆ updateData

void pqFlatTreeView::updateData ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
)
protectedslot

◆ keyPressEvent()

void pqFlatTreeView::keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ keyboardSearch()

void pqFlatTreeView::keyboardSearch ( const QString &  search)
protected

◆ mousePressEvent()

void pqFlatTreeView::mousePressEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseMoveEvent()

void pqFlatTreeView::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseReleaseEvent()

void pqFlatTreeView::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseDoubleClickEvent()

void pqFlatTreeView::mouseDoubleClickEvent ( QMouseEvent *  e)
overrideprotected

◆ event()

bool pqFlatTreeView::event ( QEvent *  e)
overrideprotected

◆ horizontalOffset()

int pqFlatTreeView::horizontalOffset ( ) const
protected

◆ verticalOffset()

int pqFlatTreeView::verticalOffset ( ) const
protected

◆ resizeEvent()

void pqFlatTreeView::resizeEvent ( QResizeEvent *  e)
overrideprotected

◆ viewportEvent()

bool pqFlatTreeView::viewportEvent ( QEvent *  e)
overrideprotected

◆ paintEvent()

void pqFlatTreeView::paintEvent ( QPaintEvent *  e)
overrideprotected

◆ getViewOptions()

QStyleOptionViewItem pqFlatTreeView::getViewOptions ( ) const
protected

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