![]() |
LeechCraft
0.6.70-13605-g8cd066ad6a
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 | |
| FlattenFilterModel (QObject *parent=0) | |
| Constructs the model with the given parent. More... | |
| QModelIndex | index (int, int, const QModelIndex &=QModelIndex()) const |
| Reimplemented from QAbstractItemModel. More... | |
| QModelIndex | parent (const QModelIndex &) const |
| Reimplemented from QAbstractItemModel. More... | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| Reimplemented from QAbstractItemModel. More... | |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| Reimplemented from QAbstractItemModel. More... | |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
| Reimplemented from QAbstractItemModel. More... | |
| void | SetSource (QAbstractItemModel *model) |
| Sets the source model to model. More... | |
Protected Member Functions | |
| virtual bool | IsIndexAccepted (const QModelIndex &index) const |
| Checks whether the given index should be included in the model. More... | |
Protected Attributes | |
| QAbstractItemModel * | Source_ |
| 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 101 of file flattenfiltermodel.h.
| LC::Util::FlattenFilterModel::FlattenFilterModel | ( | QObject * | parent = 0 | ) |
Constructs the model with the given parent.
| [in] | parent | The parent object of this model. |
Definition at line 88 of file flattenfiltermodel.cpp.
| int LC::Util::FlattenFilterModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Reimplemented from QAbstractItemModel.
Definition at line 112 of file flattenfiltermodel.cpp.
References parent(), and Source_.
Here is the call graph for this function:| QVariant LC::Util::FlattenFilterModel::data | ( | const QModelIndex & | index, |
| int | role = Qt::DisplayRole |
||
| ) | const |
Reimplemented from QAbstractItemModel.
Definition at line 117 of file flattenfiltermodel.cpp.
| QModelIndex LC::Util::FlattenFilterModel::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex () |
||
| ) | const |
Reimplemented from QAbstractItemModel.
Definition at line 94 of file flattenfiltermodel.cpp.
|
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 158 of file flattenfiltermodel.cpp.
| QModelIndex LC::Util::FlattenFilterModel::parent | ( | const QModelIndex & | ) | const |
Reimplemented from QAbstractItemModel.
Definition at line 102 of file flattenfiltermodel.cpp.
Referenced by columnCount().
Here is the caller graph for this function:| int LC::Util::FlattenFilterModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
Reimplemented from QAbstractItemModel.
Definition at line 107 of file flattenfiltermodel.cpp.
| 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 122 of file flattenfiltermodel.cpp.
|
protected |
Definition at line 131 of file flattenfiltermodel.h.
Referenced by columnCount().
|
protected |
Definition at line 132 of file flattenfiltermodel.h.