|
| GroupedItemsProxyModel (QObject *parent=Q_NULLPTR, QAbstractItemModel *sourceModel=Q_NULLPTR, const QVector< int > &groupColumns=QVector< int >()) |
| GroupedItemProxyModel. More...
|
|
| ~GroupedItemsProxyModel () |
|
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
|
int | count () |
|
QVariant | data (const QModelIndex &index, int role=Qt::EditRole) const override |
|
Qt::ItemFlags | flags (const QModelIndex &index) const override |
|
QObject * | get (int idx) const |
|
QObject * | get (const QString &uid) const |
|
int | groupColumnIsProxy () const |
|
int | groupColumnProxySrc () const |
|
int | groupColumnVisible () const |
|
QString | groupHeaderTitle () const |
|
int | groupMatchRole () const |
|
int | groupRowSelectable () const |
|
bool | hasChildren (const QModelIndex &parent=QModelIndex()) const override |
|
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
|
QModelIndex | index (int row, int column, const QModelIndex &parent) const override |
|
QMap< int, QVariant > | itemData (const QModelIndex &index) const override |
|
QModelIndex | mapFromSource (const QModelIndex &sourceIndex) const override |
|
int | mapFromSourceRow (int idx) const |
|
QModelIndex | mapToSource (const QModelIndex &proxyIndex) const override |
|
int | mapToSourceRow (int idx) const |
|
void | move (int idx, int pos, int parent=-1) |
|
QModelIndex | parent (const QModelIndex &child) const override |
|
QHash< int, QByteArray > | roleNames () const |
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
|
void | setSourceModel (QAbstractItemModel *newSourceModel) override |
|
QSize | span (const QModelIndex &index) const override |
|
| QIdentityProxyModel (QObject *parent) |
|
virtual | ~QIdentityProxyModel () |
|
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
|
virtual bool | insertColumns (int column, int count, const QModelIndex &parent) override |
|
virtual bool | insertRows (int row, int count, const QModelIndex &parent) override |
|
virtual QItemSelection | mapSelectionFromSource (const QItemSelection &selection) const const override |
|
virtual QItemSelection | mapSelectionToSource (const QItemSelection &selection) const const override |
|
virtual QModelIndexList | match (const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const override |
|
virtual const QMetaObject * | metaObject () const const |
|
virtual int | qt_metacall (QMetaObject::Call, int, void **) |
|
virtual void * | qt_metacast (const char *) |
|
virtual bool | removeColumns (int column, int count, const QModelIndex &parent) override |
|
virtual bool | removeRows (int row, int count, const QModelIndex &parent) override |
|
virtual QModelIndex | sibling (int row, int column, const QModelIndex &idx) const const override |
|
| QAbstractProxyModel (QObject *parent) |
|
virtual | ~QAbstractProxyModel () |
|
virtual QModelIndex | buddy (const QModelIndex &index) const const override |
|
virtual bool | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const const override |
|
virtual bool | canFetchMore (const QModelIndex &parent) const const override |
|
virtual void | fetchMore (const QModelIndex &parent) override |
|
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const const override |
|
virtual QStringList | mimeTypes () const const override |
|
virtual void | revert () override |
|
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
|
virtual bool | setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles) override |
|
virtual void | sort (int column, Qt::SortOrder order) override |
|
QAbstractItemModel * | sourceModel () const const |
|
void | sourceModelChanged () |
|
virtual bool | submit () override |
|
virtual Qt::DropActions | supportedDragActions () const const override |
|
virtual Qt::DropActions | supportedDropActions () const const override |
|
| QAbstractItemModel (QObject *parent) |
|
virtual | ~QAbstractItemModel () |
|
bool | checkIndex (const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options) const const |
|
void | columnsAboutToBeInserted (const QModelIndex &parent, int first, int last) |
|
void | columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn) |
|
void | columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last) |
|
void | columnsInserted (const QModelIndex &parent, int first, int last) |
|
void | columnsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) |
|
void | columnsRemoved (const QModelIndex &parent, int first, int last) |
|
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles) |
|
bool | hasIndex (int row, int column, const QModelIndex &parent) const const |
|
bool | insertColumn (int column, const QModelIndex &parent) |
|
bool | insertRow (int row, const QModelIndex &parent) |
|
void | layoutAboutToBeChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint) |
|
void | layoutChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint) |
|
void | modelAboutToBeReset () |
|
void | modelReset () |
|
bool | moveColumn (const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild) |
|
virtual bool | moveColumns (const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) |
|
bool | moveRow (const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild) |
|
virtual bool | moveRows (const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) |
|
bool | removeColumn (int column, const QModelIndex &parent) |
|
bool | removeRow (int row, const QModelIndex &parent) |
|
void | rowsAboutToBeInserted (const QModelIndex &parent, int start, int end) |
|
void | rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) |
|
void | rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last) |
|
void | rowsInserted (const QModelIndex &parent, int first, int last) |
|
void | rowsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) |
|
void | rowsRemoved (const QModelIndex &parent, int first, int last) |
|
void | setSupportedDragActions (Qt::DropActions actions) |
|
| QObject (QObject *parent) |
|
virtual | ~QObject () |
|
bool | blockSignals (bool block) |
|
const QObjectList & | children () const const |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
|
void | deleteLater () |
|
void | destroyed (QObject *obj) |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
|
bool | disconnect (const QObject *receiver, const char *method) const const |
|
void | dumpObjectInfo () const const |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () const const |
|
void | dumpObjectTree () |
|
QList< QByteArray > | dynamicPropertyNames () const const |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
|
bool | inherits (const char *className) const const |
|
void | installEventFilter (QObject *filterObj) |
|
bool | isWidgetType () const const |
|
bool | isWindowType () const const |
|
void | killTimer (int id) |
|
void | moveToThread (QThread *targetThread) |
|
QString | objectName () const const |
|
void | objectNameChanged (const QString &objectName) |
|
QObject * | parent () const const |
|
QVariant | property (const char *name) const const |
|
void | removeEventFilter (QObject *obj) |
|
void | setObjectName (const QString &name) |
|
void | setParent (QObject *parent) |
|
bool | setProperty (const char *name, const QVariant &value) |
|
bool | signalsBlocked () const const |
|
int | startTimer (int interval, Qt::TimerType timerType) |
|
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
|
QThread * | thread () const const |
|
|
virtual uint | extraColumns () const |
|
virtual GroupedProxyItem * | findGroupItem (const int group, const QVariant &value=QVariant(), GroupedProxyItem *parent=NULL) const |
|
virtual QModelIndex | indexForItem (GroupedProxyItem *item, const int col=0) const |
|
virtual bool | isProxyColumn (const QModelIndex &index) const |
|
virtual GroupedProxyItem * | itemForIndex (const QModelIndex &index, const bool rootDefault=false) const |
|
GroupedProxyItem * | itemForRow (int row, GroupedProxyItem *parent=NULL) const |
|
virtual QModelIndex | sourceIndexForProxy (GroupedProxyItem *item) const |
|
int | totalRowCount (GroupedProxyItem *parent=NULL) const |
|
void | resetInternalData () |
|
void | beginInsertColumns (const QModelIndex &parent, int first, int last) |
|
void | beginInsertRows (const QModelIndex &parent, int first, int last) |
|
bool | beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) |
|
bool | beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) |
|
void | beginRemoveColumns (const QModelIndex &parent, int first, int last) |
|
void | beginRemoveRows (const QModelIndex &parent, int first, int last) |
|
void | beginResetModel () |
|
void | changePersistentIndex (const QModelIndex &from, const QModelIndex &to) |
|
void | changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to) |
|
QModelIndex | createIndex (int row, int column, void *ptr) const const |
|
QModelIndex | createIndex (int row, int column, quintptr id) const const |
|
void | endInsertColumns () |
|
void | endInsertRows () |
|
void | endMoveColumns () |
|
void | endMoveRows () |
|
void | endRemoveColumns () |
|
void | endRemoveRows () |
|
void | endResetModel () |
|
QModelIndexList | persistentIndexList () const const |
|
void | reset () |
|
void | resetInternalData () |
|
void | setRoleNames (const QHash< int, QByteArray > &roleNames) |
|
virtual void | childEvent (QChildEvent *event) |
|
virtual void | connectNotify (const QMetaMethod &signal) |
|
virtual void | customEvent (QEvent *event) |
|
virtual void | disconnectNotify (const QMetaMethod &signal) |
|
bool | isSignalConnected (const QMetaMethod &signal) const const |
|
int | receivers (const char *signal) const const |
|
QObject * | sender () const const |
|
int | senderSignalIndex () const const |
|
virtual void | timerEvent (QTimerEvent *event) |
|
|
QString | tr (const char *s, const char *c, int n) |
|
QString | trUtf8 (const char *s, const char *c, int n) |
|
QString | tr (const char *s, const char *c, int n) |
|
QString | trUtf8 (const char *s, const char *c, int n) |
|
QString | tr (const char *s, const char *c, int n) |
|
QString | trUtf8 (const char *s, const char *c, int n) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
|
bool | disconnect (const QMetaObject::Connection &connection) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
typedef | CheckIndexOptions |
|
| DoNotUseParent |
|
| HorizontalSortHint |
|
| IndexIsValid |
|
| NoLayoutChangeHint |
|
| NoOption |
|
| ParentIsInvalid |
|
| VerticalSortHint |
|
GroupedItemsProxyModel allows a grouped item presentation of a flat table data model.
- Version
- 1.0.0
GroupedItemsProxyModel allows a grouped item presentation of a flat table data model. Items can be visually grouped by data in one or more columns of the original data. Any number of groupings can be nested. GroupedItemsProxyModel inherits from QIdentityProxyModel and proxies all data from the original model unmodified. Only the visual presentation is affected, for example like QSortFilterProxyModel.
Groupings can be managed with addGroup(), insertGroup() and removeGroup(). Each function takes a column number as a parameter. The source data is scanned, and a new grouping row is created for each unique value found in the given column. The title (and icon, if any) of the grouping row is taken from the source data (Qt::DisplayRole
and Qt::DecorationRole
respectively). By default, items are grouped based on their Qt::EditRole
but you can change this with setGroupMatchRole().
When grouping is active, a new first column is (optionally) added which can be used to sort the groupings. By default the groups are shown in the order in which they were found in the source data. The extra column can be disabled with setGroupColumnVisible(). The title of the column can be set with setGroupHeaderTitle().
This model can be cascased with other models. For example set this model as the source for a QSortFilterProxyModel to enable sorting the view (including the grouping items as mentioned above).
This model can only handle flat data models as input (table/list). It will not include any children of the top-level items.
When no groupings have been added, this acts as a transparent proxy (see QIdentityProxyModel). However the limitation of only flat source models still applies.
Definition at line 64 of file GroupedItemsProxyModel.h.