![]() |
LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
|
Proxy model flattening a hierarchical model. More...
#include "flattenfiltermodel.h"
Inheritance diagram for LC::Util::FlattenFilterModel:
Collaboration diagram for LC::Util::FlattenFilterModel:Public Member Functions | |
| QModelIndex | index (int, int, const QModelIndex &={}) const override |
| Reimplemented from QAbstractItemModel. | |
| QModelIndex | parent (const QModelIndex &) const override |
| Reimplemented from QAbstractItemModel. | |
| int | rowCount (const QModelIndex &parent={}) const override |
| Reimplemented from QAbstractItemModel. | |
| int | columnCount (const QModelIndex &parent={}) const override |
| Reimplemented from QAbstractItemModel. | |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| Reimplemented from QAbstractItemModel. | |
| void | SetSource (QAbstractItemModel *model) |
| Sets the source model to model. | |
Protected Member Functions | |
| virtual bool | IsIndexAccepted (const QModelIndex &index) const |
| Checks whether the given index should be included in the model. | |
Protected Attributes | |
| QAbstractItemModel * | Source_ = nullptr |
| QList< QPersistentModelIndex > | SourceIndexes_ |
Proxy model flattening a hierarchical model.
This model takes another model and folds its structure into a flat model, possibly filtering out some rows (via the IsIndexAccepted() method).
Since this model changes the structure of the source model quite a lot, it doesn't derive from QAbstractProxyModel.
Definition at line 27 of file flattenfiltermodel.h.
|
override |
Reimplemented from QAbstractItemModel.
Definition at line 31 of file flattenfiltermodel.cpp.
References parent().
Here is the call graph for this function:
|
override |
Reimplemented from QAbstractItemModel.
Definition at line 36 of file flattenfiltermodel.cpp.
References LC::Util::Filter(), index(), and SourceIndexes_.
Here is the call graph for this function:
|
override |
Reimplemented from QAbstractItemModel.
Definition at line 13 of file flattenfiltermodel.cpp.
References LC::Util::Filter(), and parent().
Referenced by data().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protectedvirtual |
Checks whether the given index should be included in the model.
Reimplement this function in derived classes to provide filtering capabilities akin to QSortFilterProxyModel.
The children of the index will be checked even if this function returns false for index.
index.column() == 0 will always hold.The default implementation simply returns true.
| [in] | index | The index of the source model to check. |
Definition at line 67 of file flattenfiltermodel.cpp.
|
override |
Reimplemented from QAbstractItemModel.
Definition at line 21 of file flattenfiltermodel.cpp.
References LC::Util::Filter().
Referenced by columnCount(), index(), and rowCount().
Here is the call graph for this function:
Here is the caller graph for this function:
|
override |
Reimplemented from QAbstractItemModel.
Definition at line 26 of file flattenfiltermodel.cpp.
References parent(), and SourceIndexes_.
Here is the call graph for this function:| void LC::Util::FlattenFilterModel::SetSource | ( | QAbstractItemModel * | model | ) |
Sets the source model to model.
If another source model has been set already, this function rebuilds the whole model, effectively resetting it.
| [in] | model | The new source model. |
Definition at line 41 of file flattenfiltermodel.cpp.
References LC::Util::Filter(), Source_, and SourceIndexes_.
Here is the call graph for this function:
|
protected |
Definition at line 30 of file flattenfiltermodel.h.
Referenced by SetSource().
|
protected |
Definition at line 31 of file flattenfiltermodel.h.
Referenced by data(), rowCount(), and SetSource().