#include <checkableModelHelper.h>
|
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.
|
|
void | toggleHeaderCheckState (int section) |
|
|
| CheckableModelHelper (Qt::Orientation orientation, QObject *parent=0) |
|
Qt::Orientation | orientation () const |
|
QAbstractItemModel * | model () const |
|
virtual void | setModel (QAbstractItemModel *model) |
|
QModelIndex | rootIndex () const |
| Reimplemented for internal reasons.
|
|
virtual void | setRootIndex (const QModelIndex &index) |
|
bool | isHeaderCheckable (int section) const |
|
bool | isCheckable (const QModelIndex &index) const |
|
Qt::CheckState | headerCheckState (int section) const |
|
Qt::CheckState | checkState (const QModelIndex &) const |
|
bool | headerCheckState (int section, Qt::CheckState &checkState) const |
|
bool | checkState (const QModelIndex &, Qt::CheckState &checkState) const |
|
void | setPropagateDepth (int depth) |
|
int | propagateDepth () const |
|
void | setForceCheckability (bool force) |
| When true, the new items are automatically set to checkable.
|
|
bool | forceCheckability () const |
|
Qt::CheckState | defaultCheckState () const |
|
void | setDefaultCheckState (Qt::CheckState) |
|
|
bool | forceCheckability |
|
int | propagateDepth |
|
Qt::CheckState | defaultCheckState |
|
|
void | onHeaderDataChanged (Qt::Orientation orient, int first, int last) |
|
void | onDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
|
void | updateHeadersFromItems () |
|
void | onColumnsInserted (const QModelIndex &parent, int start, int end) |
|
void | onRowsInserted (const QModelIndex &parent, int start, int end) |
|
CheckableModelHelper expose functions to handle checkable models
◆ headerCheckState() [1/2]
Qt::CheckState CheckableModelHelper::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 CheckableModelHelper::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)
◆ isHeaderCheckable()
bool CheckableModelHelper::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 * CheckableModelHelper::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)
◆ setHeaderCheckState
void CheckableModelHelper::setHeaderCheckState |
( |
int | section, |
|
|
Qt::CheckState | checkState ) |
|
slot |
Warning, setting the check state automatically set the header section checkable
◆ setPropagateDepth()
void CheckableModelHelper::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
The documentation for this class was generated from the following files:
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/helper/checkableModelHelper.h
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/helper/checkableModelHelper.cpp