31 #ifndef CHECKABLEMODELHELPER_H
32 #define CHECKABLEMODELHELPER_H
35 #include <QModelIndex>
37 class QAbstractItemModel;
50 Q_PROPERTY(Qt::CheckState defaultCheckState READ defaultCheckState WRITE setDefaultCheckState);
56 Qt::Orientation orientation()
const;
66 QAbstractItemModel *
model()
const;
67 virtual void setModel(QAbstractItemModel *model);
71 virtual void setRootIndex(
const QModelIndex &index);
78 bool isCheckable(
const QModelIndex& index)
const;
85 Qt::CheckState checkState(
const QModelIndex&)
const;
92 bool checkState(
const QModelIndex&, Qt::CheckState& checkState )
const;
98 int propagateDepth()
const;
102 bool forceCheckability()
const;
104 Qt::CheckState defaultCheckState()
const;
105 void setDefaultCheckState(Qt::CheckState);
108 void setCheckState(
const QModelIndex& modelIndex, Qt::CheckState checkState);
116 void toggleHeaderCheckState(
int section);
119 void onHeaderDataChanged(Qt::Orientation orient,
int first,
int last);
121 void onDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
122 void updateHeadersFromItems();
123 void onColumnsInserted(
const QModelIndex& parent,
int start,
int end);
124 void onRowsInserted(
const QModelIndex& parent,
int start,
int end);
127 QScopedPointer<CheckableModelHelperPrivate> d_ptr;
bool isHeaderCheckable(int section) const
Definition: checkableModelHelper.cpp:627
QAbstractItemModel * model() const
Definition: checkableModelHelper.cpp:314
Qt::CheckState headerCheckState(int section) const
Definition: checkableModelHelper.cpp:649
Definition: checkableModelHelper.cpp:41
void setPropagateDepth(int depth)
Definition: checkableModelHelper.cpp:394
QModelIndex rootIndex() const
Reimplemented for internal reasons.
Definition: checkableModelHelper.cpp:376
void setForceCheckability(bool force)
When true, the new items are automatically set to checkable.
Definition: checkableModelHelper.cpp:429
Definition: checkableModelHelper.h:45
void toggleCheckState(const QModelIndex &modelIndex)
Utility function to toggle the checkstate of an index.
Definition: checkableModelHelper.cpp:487
void setHeaderCheckState(int section, Qt::CheckState checkState)
Definition: checkableModelHelper.cpp:465