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 Attributes | Properties | List of all members
ctkCheckableModelHelper Class Reference

#include <Libs/Widgets/ctkCheckableModelHelper.h>

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

Public Slots

void setCheckState (const QModelIndex &modelIndex, Qt::CheckState checkState)
 
void setHeaderCheckState (int section, Qt::CheckState checkState)
 
void toggleCheckState (const QModelIndex &modelIndex)
 Utility function to toggle the checkstate of an index. More...
 
void toggleHeaderCheckState (int section)
 

Public Member Functions

Qt::CheckState checkState (const QModelIndex &) const
 
bool checkState (const QModelIndex &, Qt::CheckState &checkState) const
 
 ctkCheckableModelHelper (Qt::Orientation orientation, QObject *parent=0)
 
Qt::CheckState defaultCheckState () const
 
bool forceCheckability () const
 
Qt::CheckState headerCheckState (int section) const
 
bool headerCheckState (int section, Qt::CheckState &checkState) const
 
bool isCheckable (const QModelIndex &index) const
 
bool isHeaderCheckable (int section) const
 
QAbstractItemModel * model () const
 
Qt::Orientation orientation () const
 
int propagateDepth () const
 
QModelIndex rootIndex () const
 Reimplemented for internal reasons. More...
 
void setDefaultCheckState (Qt::CheckState)
 
void setForceCheckability (bool force)
 When true, the new items are automatically set to checkable. More...
 
virtual void setModel (QAbstractItemModel *model)
 
void setPropagateDepth (int depth)
 
virtual void setRootIndex (const QModelIndex &index)
 
virtual ~ctkCheckableModelHelper ()
 

Protected Attributes

QScopedPointer< ctkCheckableModelHelperPrivate > d_ptr
 

Properties

Qt::CheckState defaultCheckState
 
bool forceCheckability
 
int propagateDepth
 

Detailed Description

ctkCheckableModelHelper expose functions to handle checkable models

Definition at line 68 of file ctkCheckableModelHelper.h.

Constructor & Destructor Documentation

◆ ctkCheckableModelHelper()

ctkCheckableModelHelper::ctkCheckableModelHelper ( Qt::Orientation  orientation,
QObject *  parent = 0 
)

◆ ~ctkCheckableModelHelper()

virtual ctkCheckableModelHelper::~ctkCheckableModelHelper ( )
virtual

Member Function Documentation

◆ checkState() [1/2]

Qt::CheckState ctkCheckableModelHelper::checkState ( const QModelIndex &  ) const

◆ checkState() [2/2]

bool ctkCheckableModelHelper::checkState ( const QModelIndex &  ,
Qt::CheckState &  checkState 
) const

◆ defaultCheckState()

Qt::CheckState ctkCheckableModelHelper::defaultCheckState ( ) const

◆ forceCheckability()

bool ctkCheckableModelHelper::forceCheckability ( ) const

◆ headerCheckState() [1/2]

Qt::CheckState ctkCheckableModelHelper::headerCheckState ( 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)

◆ headerCheckState() [2/2]

bool ctkCheckableModelHelper::headerCheckState ( 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)

◆ isCheckable()

bool ctkCheckableModelHelper::isCheckable ( const QModelIndex &  index) const

◆ isHeaderCheckable()

bool ctkCheckableModelHelper::isHeaderCheckable ( int  section) const

A section is checkable if its CheckStateRole data is non null. One can access the same value through the model: model->headerData(orientation, section, Qt::CheckStateRole).isEmpty()

◆ model()

QAbstractItemModel* ctkCheckableModelHelper::model ( ) const

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(myCheckableModelHelper)), you can call myModel.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole) or myCheckableModelHelper->setCheckState(0, Qt::Checked)

◆ orientation()

Qt::Orientation ctkCheckableModelHelper::orientation ( ) const

◆ propagateDepth()

int ctkCheckableModelHelper::propagateDepth ( ) const

◆ rootIndex()

QModelIndex ctkCheckableModelHelper::rootIndex ( ) const

Reimplemented for internal reasons.

◆ setCheckState

void ctkCheckableModelHelper::setCheckState ( const QModelIndex &  modelIndex,
Qt::CheckState  checkState 
)
slot

◆ setDefaultCheckState()

void ctkCheckableModelHelper::setDefaultCheckState ( Qt::CheckState  )

◆ setForceCheckability()

void ctkCheckableModelHelper::setForceCheckability ( bool  force)

When true, the new items are automatically set to checkable.

◆ setHeaderCheckState

void ctkCheckableModelHelper::setHeaderCheckState ( int  section,
Qt::CheckState  checkState 
)
slot

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

◆ setModel()

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

◆ setPropagateDepth()

void ctkCheckableModelHelper::setPropagateDepth ( int  depth)

How deep in the model(tree) do you want the check state to be propagated A value of -1 correspond to the deepest level of the model. -1 by default

◆ setRootIndex()

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

◆ toggleCheckState

void ctkCheckableModelHelper::toggleCheckState ( const QModelIndex &  modelIndex)
slot

Utility function to toggle the checkstate of an index.

◆ toggleHeaderCheckState

void ctkCheckableModelHelper::toggleHeaderCheckState ( int  section)
slot

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkCheckableModelHelperPrivate> ctkCheckableModelHelper::d_ptr
protected

Definition at line 150 of file ctkCheckableModelHelper.h.

Property Documentation

◆ defaultCheckState

Qt::CheckState ctkCheckableModelHelper::defaultCheckState
readwrite

Definition at line 1 of file ctkCheckableModelHelper.h.

◆ forceCheckability

bool ctkCheckableModelHelper::forceCheckability
readwrite

Definition at line 1 of file ctkCheckableModelHelper.h.

◆ propagateDepth

int ctkCheckableModelHelper::propagateDepth
readwrite

Definition at line 1 of file ctkCheckableModelHelper.h.


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