CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ctkCheckableHeaderView Class Reference

#include <Libs/Widgets/ctkCheckableHeaderView.h>

Inheritance diagram for ctkCheckableHeaderView:
Inheritance graph
[legend]
Collaboration diagram for ctkCheckableHeaderView:
Collaboration graph
[legend]

Public Slots

void setCheckState (int section, Qt::CheckState checkState)
 

Public Member Functions

ctkCheckableModelHelpercheckableModelHelper () const
 
Qt::CheckState checkState (int section) const
 
bool checkState (int section, Qt::CheckState &checkState) const
 
 ctkCheckableHeaderView (Qt::Orientation orient, QWidget *parent=0)
 
virtual bool eventFilter (QObject *object, QEvent *e)
 
virtual void setModel (QAbstractItemModel *model)
 
virtual void setRootIndex (const QModelIndex &index)
 Reimplemented for internal reasons. More...
 
virtual ~ctkCheckableHeaderView ()
 

Protected Member Functions

virtual void initStyleSectionOption (QStyleOptionHeader *option, int section, QRect rect) const
 
bool isPointInCheckBox (int section, QPoint pos) const
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 
virtual void updateHeaderPixmaps (int first, int last)
 

Protected Attributes

QScopedPointer< ctkCheckableHeaderViewPrivate > d_ptr
 

Detailed Description

ctkCheckableHeaderView is a QHeaderView that can display a checkbox for any header section. If propageteToItems, the check state of the header section is set to all items in the header row/column of the QAbstractItemModel if the items are checkable. ctkCheckableHeaderView also supports row/column sorting. TBD: It should probably be a QSortFilterProxyModel that adds a checkability data on top of the indexes.

Definition at line 74 of file ctkCheckableHeaderView.h.

Constructor & Destructor Documentation

◆ ctkCheckableHeaderView()

ctkCheckableHeaderView::ctkCheckableHeaderView ( Qt::Orientation  orient,
QWidget *  parent = 0 
)

◆ ~ctkCheckableHeaderView()

virtual ctkCheckableHeaderView::~ctkCheckableHeaderView ( )
virtual

Member Function Documentation

◆ checkableModelHelper()

ctkCheckableModelHelper* ctkCheckableHeaderView::checkableModelHelper ( ) const

◆ checkState() [1/2]

Qt::CheckState ctkCheckableHeaderView::checkState ( int  section) const

Utility function that returns the checkState of the section. One can access the same value through the model: model->headerData(orientation, section, Qt::CheckStateRole)

◆ checkState() [2/2]

bool ctkCheckableHeaderView::checkState ( int  section,
Qt::CheckState &  checkState 
) const

Utility function that returns the checkState of the section. One can access the same value through the model: model->headerData(orientation, section, Qt::CheckStateRole)

◆ eventFilter()

virtual bool ctkCheckableHeaderView::eventFilter ( QObject *  object,
QEvent *  e 
)
virtual

Used to listen for focus in/out events.

Parameters
objectThe object receiving the event.
eEvent specific data.
Returns
True if the event should be filtered out.

◆ initStyleSectionOption()

virtual void ctkCheckableHeaderView::initStyleSectionOption ( QStyleOptionHeader *  option,
int  section,
QRect  rect 
) const
protectedvirtual

◆ isPointInCheckBox()

bool ctkCheckableHeaderView::isPointInCheckBox ( int  section,
QPoint  pos 
) const
protected

◆ mousePressEvent()

virtual void ctkCheckableHeaderView::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

◆ mouseReleaseEvent()

virtual void ctkCheckableHeaderView::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual

◆ setCheckState

void ctkCheckableHeaderView::setCheckState ( int  section,
Qt::CheckState  checkState 
)
slot

Warning, setting the check state automatically set the header section checkable

◆ setModel()

virtual void ctkCheckableHeaderView::setModel ( QAbstractItemModel *  model)
virtual

When setting the model, if PropagateToItems is true (by default), the check state of the checkable headers is updated from the check state of the items If you want to make sure of the check state of a header, after setting the (done by myView.setHeader(myCheckableHeaderView)), you can call myModel.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole) or myCheckableHeaderView->setCheckState(0, Qt::Checked)

◆ setRootIndex()

virtual void ctkCheckableHeaderView::setRootIndex ( const QModelIndex &  index)
virtual

Reimplemented for internal reasons.

◆ updateHeaderPixmaps()

virtual void ctkCheckableHeaderView::updateHeaderPixmaps ( int  first,
int  last 
)
protectedvirtual

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkCheckableHeaderViewPrivate> ctkCheckableHeaderView::d_ptr
protected

Definition at line 135 of file ctkCheckableHeaderView.h.


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