maxLibQt
GroupedItemsProxyModel Class Reference

GroupedItemsProxyModel allows a grouped item presentation of a flat table data model. More...

#include "GroupedItemsProxyModel.h"

Inherits QIdentityProxyModel.

Classes

class  GroupedProxyItem
 

Public Types

enum  { SourceRowNumberRole = Qt::UserRole - 5 }
 
- Public Types inherited from QAbstractItemModel
enum  CheckIndexOption
 
enum  LayoutChangeHint
 

Properties

int count
 
bool groupColumnIsProxy
 
int groupColumnProxySrc
 
bool groupColumnVisible
 
QString groupHeaderTitle
 
int groupMatchRole
 
bool groupRowSelectable
 
- Properties inherited from QAbstractProxyModel
 sourceModel
 
- Properties inherited from QObject
 objectName
 

Public Member Functions

 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
 
QObjectget (int idx) const
 
QObjectget (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, QVariantitemData (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, QByteArrayroleNames () const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setSourceModel (QAbstractItemModel *newSourceModel) override
 
QSize span (const QModelIndex &index) const override
 
- Public Member Functions inherited from QIdentityProxyModel
 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 QMetaObjectmetaObject () 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
 
- Public Member Functions inherited from QAbstractProxyModel
 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 QMimeDatamimeData (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 setHeaderData (int section, Qt::Orientation orientation, 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
 
QAbstractItemModelsourceModel () const const
 
void sourceModelChanged ()
 
virtual bool submit () override
 
virtual Qt::DropActions supportedDragActions () const const override
 
virtual Qt::DropActions supportedDropActions () const const override
 
- Public Member Functions inherited from QAbstractItemModel
 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
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
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)
 
- Public Member Functions inherited from QObject
 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< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, 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)
 
QObjectparent () 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)
 
QThreadthread () const const
 

Public Slots

void addGroup (int column)
 Add a new grouping based on column. More...
 
virtual void addGroups (const QVector< int > &columns)
 Add multiple groupings based on columns. More...
 
virtual void clearGroups ()
 Remove the previously-added groupings. More...
 
virtual void insertGroup (int index, int column)
 Insert a new grouping at index based on column. More...
 
virtual void removeGroup (int column)
 Remove the previously-added column grouping. More...
 
virtual void setGroupColumnIsProxy (bool enable)
 
virtual void setGroupColumnProxySrc (int column)
 
virtual void setGroupColumnVisible (bool visible)
 
virtual void setGroupHeaderTitle (const QString &title, const QString &tooltip=QString())
 
virtual void setGroupMatchRole (int role)
 
virtual void setGroupRowSelectable (bool selectable)
 
virtual void setGroups (const QVector< int > &columns)
 Add multiple groupings based on columns. More...
 
virtual void setRootGroup (int column=-1, const QVariant &value=QVariant())
 Sets parent group. More...
 

Signals

void countChanged ()
 

Protected Slots

virtual void dataChangedHandler (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
 
virtual void modelResetHandler ()
 
virtual GroupedProxyItemplaceSourceRow (const int row)
 
virtual void reloadSourceModel ()
 
virtual void removeItem (GroupedProxyItem *item)
 
virtual void removeUnusedGroups (GroupedProxyItem *parent=NULL)
 
virtual void rowsInsertedHandler (const QModelIndex &parent, int first, int last)
 
virtual void rowsMovedHandler (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
 
virtual void rowsRemovedHandler (const QModelIndex &parent, int first, int last)
 

Protected Member Functions

virtual uint extraColumns () const
 
virtual GroupedProxyItemfindGroupItem (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 GroupedProxyItemitemForIndex (const QModelIndex &index, const bool rootDefault=false) const
 
GroupedProxyItemitemForRow (int row, GroupedProxyItem *parent=NULL) const
 
virtual QModelIndex sourceIndexForProxy (GroupedProxyItem *item) const
 
int totalRowCount (GroupedProxyItem *parent=NULL) const
 
- Protected Member Functions inherited from QAbstractProxyModel
void resetInternalData ()
 
- Protected Member Functions inherited from QAbstractItemModel
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)
 
- Protected Member Functions inherited from QObject
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
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

GroupedProxyItemm_defaultParent
 
int m_defaultParentGroup
 
bool m_groupColumnIsProxy
 
int m_groupColumnProxySrc
 
bool m_groupColumnVisible
 
int m_groupMatchRole
 
bool m_groupRowSelectable
 
QVector< int > m_groups
 
GroupedProxyItemm_root
 
bool m_rowsAreMoving
 
QHash< int, GroupedProxyItem * > m_sourceMap
 

Additional Inherited Members

- Static Public Member Functions inherited from QIdentityProxyModel
QString tr (const char *s, const char *c, int n)
 
QString trUtf8 (const char *s, const char *c, int n)
 
- Static Public Member Functions inherited from QAbstractProxyModel
QString tr (const char *s, const char *c, int n)
 
QString trUtf8 (const char *s, const char *c, int n)
 
- Static Public Member Functions inherited from QAbstractItemModel
QString tr (const char *s, const char *c, int n)
 
QString trUtf8 (const char *s, const char *c, int n)
 
- Static Public Member Functions inherited from QObject
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)
 
- Public Attributes inherited from QAbstractItemModel
typedef CheckIndexOptions
 
 DoNotUseParent
 
 HorizontalSortHint
 
 IndexIsValid
 
 NoLayoutChangeHint
 
 NoOption
 
 ParentIsInvalid
 
 VerticalSortHint
 

Detailed Description

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.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SourceRowNumberRole 

Definition at line 76 of file GroupedItemsProxyModel.h.

Constructor & Destructor Documentation

◆ GroupedItemsProxyModel()

GroupedItemsProxyModel::GroupedItemsProxyModel ( QObject parent = Q_NULLPTR,
QAbstractItemModel sourceModel = Q_NULLPTR,
const QVector< int > &  groupColumns = QVector<int>() 
)
explicit

GroupedItemProxyModel.

Definition at line 101 of file GroupedItemsProxyModel.cpp.

◆ ~GroupedItemsProxyModel()

GroupedItemsProxyModel::~GroupedItemsProxyModel ( )

Definition at line 127 of file GroupedItemsProxyModel.cpp.

Property Documentation

◆ count

int GroupedItemsProxyModel::count
read

Definition at line 73 of file GroupedItemsProxyModel.h.

◆ groupColumnIsProxy

bool GroupedItemsProxyModel::groupColumnIsProxy
readwrite

Definition at line 69 of file GroupedItemsProxyModel.h.

◆ groupColumnProxySrc

int GroupedItemsProxyModel::groupColumnProxySrc
readwrite

Definition at line 70 of file GroupedItemsProxyModel.h.

◆ groupColumnVisible

bool GroupedItemsProxyModel::groupColumnVisible
readwrite

Definition at line 68 of file GroupedItemsProxyModel.h.

◆ groupHeaderTitle

QString GroupedItemsProxyModel::groupHeaderTitle
readwrite

Definition at line 72 of file GroupedItemsProxyModel.h.

◆ groupMatchRole

int GroupedItemsProxyModel::groupMatchRole
readwrite

Definition at line 67 of file GroupedItemsProxyModel.h.

◆ groupRowSelectable

bool GroupedItemsProxyModel::groupRowSelectable
readwrite

Definition at line 71 of file GroupedItemsProxyModel.h.

Member Function Documentation

◆ addGroup

void GroupedItemsProxyModel::addGroup ( int  column)
inlineslot

Add a new grouping based on column.

See also
removeGroup()

Definition at line 148 of file GroupedItemsProxyModel.h.

◆ addGroups

void GroupedItemsProxyModel::addGroups ( const QVector< int > &  columns)
virtualslot

Add multiple groupings based on columns.

The groups are appended to any existing group(s).

See also
clearGroups()

Definition at line 293 of file GroupedItemsProxyModel.cpp.

◆ clearGroups

void GroupedItemsProxyModel::clearGroups ( )
virtualslot

Remove the previously-added groupings.

See also
addGroup(), addGroups()

Definition at line 332 of file GroupedItemsProxyModel.cpp.

◆ columnCount()

int GroupedItemsProxyModel::columnCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 176 of file GroupedItemsProxyModel.cpp.

◆ count()

int GroupedItemsProxyModel::count ( )
inline

Definition at line 100 of file GroupedItemsProxyModel.h.

◆ countChanged

void GroupedItemsProxyModel::countChanged ( )
signal

◆ data()

QVariant GroupedItemsProxyModel::data ( const QModelIndex index,
int  role = Qt::EditRole 
) const
overridevirtual

Reimplemented from QAbstractProxyModel.

Definition at line 186 of file GroupedItemsProxyModel.cpp.

◆ dataChangedHandler

void GroupedItemsProxyModel::dataChangedHandler ( const QModelIndex topLeft,
const QModelIndex bottomRight,
const QVector< int > &  roles = QVector<int>() 
)
protectedvirtualslot

Definition at line 567 of file GroupedItemsProxyModel.cpp.

◆ extraColumns()

virtual uint GroupedItemsProxyModel::extraColumns ( ) const
inlineprotectedvirtual

Definition at line 172 of file GroupedItemsProxyModel.h.

◆ findGroupItem()

GroupedItemsProxyModel::GroupedProxyItem * GroupedItemsProxyModel::findGroupItem ( const int  group,
const QVariant value = QVariant(),
GroupedProxyItem parent = NULL 
) const
protectedvirtual

Definition at line 434 of file GroupedItemsProxyModel.cpp.

◆ flags()

Qt::ItemFlags GroupedItemsProxyModel::flags ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractProxyModel.

Definition at line 235 of file GroupedItemsProxyModel.cpp.

◆ get() [1/2]

QObject* GroupedItemsProxyModel::get ( int  idx) const
inline

Definition at line 106 of file GroupedItemsProxyModel.h.

◆ get() [2/2]

QObject* GroupedItemsProxyModel::get ( const QString uid) const
inline

Definition at line 117 of file GroupedItemsProxyModel.h.

◆ groupColumnIsProxy()

int GroupedItemsProxyModel::groupColumnIsProxy ( ) const
inline

Definition at line 135 of file GroupedItemsProxyModel.h.

◆ groupColumnProxySrc()

int GroupedItemsProxyModel::groupColumnProxySrc ( ) const
inline

Definition at line 137 of file GroupedItemsProxyModel.h.

◆ groupColumnVisible()

int GroupedItemsProxyModel::groupColumnVisible ( ) const
inline

Definition at line 133 of file GroupedItemsProxyModel.h.

◆ groupHeaderTitle()

QString GroupedItemsProxyModel::groupHeaderTitle ( ) const
inline

Definition at line 141 of file GroupedItemsProxyModel.h.

◆ groupMatchRole()

int GroupedItemsProxyModel::groupMatchRole ( ) const
inline

Definition at line 131 of file GroupedItemsProxyModel.h.

◆ groupRowSelectable()

int GroupedItemsProxyModel::groupRowSelectable ( ) const
inline

Definition at line 139 of file GroupedItemsProxyModel.h.

◆ hasChildren()

bool GroupedItemsProxyModel::hasChildren ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QAbstractProxyModel.

Definition at line 181 of file GroupedItemsProxyModel.cpp.

◆ headerData()

QVariant GroupedItemsProxyModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 219 of file GroupedItemsProxyModel.cpp.

◆ index()

QModelIndex GroupedItemsProxyModel::index ( int  row,
int  column,
const QModelIndex parent 
) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 150 of file GroupedItemsProxyModel.cpp.

◆ indexForItem()

QModelIndex GroupedItemsProxyModel::indexForItem ( GroupedProxyItem item,
const int  col = 0 
) const
protectedvirtual

Definition at line 413 of file GroupedItemsProxyModel.cpp.

◆ insertGroup

void GroupedItemsProxyModel::insertGroup ( int  index,
int  column 
)
virtualslot

Insert a new grouping at index based on column.

See also
addGroup(), removeGroup()

Definition at line 317 of file GroupedItemsProxyModel.cpp.

◆ isProxyColumn()

virtual bool GroupedItemsProxyModel::isProxyColumn ( const QModelIndex index) const
inlineprotectedvirtual

Definition at line 177 of file GroupedItemsProxyModel.h.

◆ itemData()

QMap< int, QVariant > GroupedItemsProxyModel::itemData ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractProxyModel.

Definition at line 204 of file GroupedItemsProxyModel.cpp.

◆ itemForIndex()

GroupedItemsProxyModel::GroupedProxyItem * GroupedItemsProxyModel::itemForIndex ( const QModelIndex index,
const bool  rootDefault = false 
) const
protectedvirtual

Definition at line 421 of file GroupedItemsProxyModel.cpp.

◆ itemForRow()

GroupedItemsProxyModel::GroupedProxyItem * GroupedItemsProxyModel::itemForRow ( int  row,
GroupedProxyItem parent = NULL 
) const
protected

Definition at line 470 of file GroupedItemsProxyModel.cpp.

◆ mapFromSource()

QModelIndex GroupedItemsProxyModel::mapFromSource ( const QModelIndex sourceIndex) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 282 of file GroupedItemsProxyModel.cpp.

◆ mapFromSourceRow()

int GroupedItemsProxyModel::mapFromSourceRow ( int  idx) const
inline

Definition at line 104 of file GroupedItemsProxyModel.h.

◆ mapToSource()

QModelIndex GroupedItemsProxyModel::mapToSource ( const QModelIndex proxyIndex) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 271 of file GroupedItemsProxyModel.cpp.

◆ mapToSourceRow()

int GroupedItemsProxyModel::mapToSourceRow ( int  idx) const
inline

Definition at line 103 of file GroupedItemsProxyModel.h.

◆ modelResetHandler

void GroupedItemsProxyModel::modelResetHandler ( )
protectedvirtualslot

Definition at line 562 of file GroupedItemsProxyModel.cpp.

◆ move()

void GroupedItemsProxyModel::move ( int  idx,
int  pos,
int  parent = -1 
)

Definition at line 343 of file GroupedItemsProxyModel.cpp.

◆ parent()

QModelIndex GroupedItemsProxyModel::parent ( const QModelIndex child) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 158 of file GroupedItemsProxyModel.cpp.

◆ placeSourceRow

GroupedItemsProxyModel::GroupedProxyItem * GroupedItemsProxyModel::placeSourceRow ( const int  row)
protectedvirtualslot

Definition at line 490 of file GroupedItemsProxyModel.cpp.

◆ reloadSourceModel

void GroupedItemsProxyModel::reloadSourceModel ( )
protectedvirtualslot

Definition at line 548 of file GroupedItemsProxyModel.cpp.

◆ removeGroup

void GroupedItemsProxyModel::removeGroup ( int  column)
virtualslot

Remove the previously-added column grouping.

See also
addGroup()

Definition at line 326 of file GroupedItemsProxyModel.cpp.

◆ removeItem

void GroupedItemsProxyModel::removeItem ( GroupedProxyItem item)
protectedvirtualslot

Definition at line 519 of file GroupedItemsProxyModel.cpp.

◆ removeUnusedGroups

void GroupedItemsProxyModel::removeUnusedGroups ( GroupedProxyItem parent = NULL)
protectedvirtualslot

Definition at line 534 of file GroupedItemsProxyModel.cpp.

◆ roleNames()

QHash< int, QByteArray > GroupedItemsProxyModel::roleNames ( ) const
virtual

Reimplemented from QAbstractItemModel.

Definition at line 266 of file GroupedItemsProxyModel.cpp.

◆ rowCount()

int GroupedItemsProxyModel::rowCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 171 of file GroupedItemsProxyModel.cpp.

◆ rowsInsertedHandler

void GroupedItemsProxyModel::rowsInsertedHandler ( const QModelIndex parent,
int  first,
int  last 
)
protectedvirtualslot

Definition at line 606 of file GroupedItemsProxyModel.cpp.

◆ rowsMovedHandler

void GroupedItemsProxyModel::rowsMovedHandler ( const QModelIndex parent,
int  start,
int  end,
const QModelIndex destination,
int  row 
)
protectedvirtualslot

Definition at line 631 of file GroupedItemsProxyModel.cpp.

◆ rowsRemovedHandler

void GroupedItemsProxyModel::rowsRemovedHandler ( const QModelIndex parent,
int  first,
int  last 
)
protectedvirtualslot

Definition at line 615 of file GroupedItemsProxyModel.cpp.

◆ setGroupColumnIsProxy

virtual void GroupedItemsProxyModel::setGroupColumnIsProxy ( bool  enable)
inlinevirtualslot

Definition at line 164 of file GroupedItemsProxyModel.h.

◆ setGroupColumnProxySrc

virtual void GroupedItemsProxyModel::setGroupColumnProxySrc ( int  column)
inlinevirtualslot

Definition at line 165 of file GroupedItemsProxyModel.h.

◆ setGroupColumnVisible

virtual void GroupedItemsProxyModel::setGroupColumnVisible ( bool  visible)
inlinevirtualslot

Definition at line 163 of file GroupedItemsProxyModel.h.

◆ setGroupHeaderTitle

void GroupedItemsProxyModel::setGroupHeaderTitle ( const QString title,
const QString tooltip = QString() 
)
virtualslot

Definition at line 398 of file GroupedItemsProxyModel.cpp.

◆ setGroupMatchRole

void GroupedItemsProxyModel::setGroupMatchRole ( int  role)
virtualslot

Definition at line 389 of file GroupedItemsProxyModel.cpp.

◆ setGroupRowSelectable

virtual void GroupedItemsProxyModel::setGroupRowSelectable ( bool  selectable)
inlinevirtualslot

Definition at line 166 of file GroupedItemsProxyModel.h.

◆ setGroups

void GroupedItemsProxyModel::setGroups ( const QVector< int > &  columns)
virtualslot

Add multiple groupings based on columns.

Any existing group(s) are first cleared.

See also
clearGroups()

Definition at line 304 of file GroupedItemsProxyModel.cpp.

◆ setRootGroup

void GroupedItemsProxyModel::setRootGroup ( int  column = -1,
const QVariant value = QVariant() 
)
virtualslot

Sets parent group.

Definition at line 373 of file GroupedItemsProxyModel.cpp.

◆ setSourceModel()

void GroupedItemsProxyModel::setSourceModel ( QAbstractItemModel newSourceModel)
overridevirtual

Reimplemented from QIdentityProxyModel.

Definition at line 132 of file GroupedItemsProxyModel.cpp.

◆ sourceIndexForProxy()

QModelIndex GroupedItemsProxyModel::sourceIndexForProxy ( GroupedItemsProxyModel::GroupedProxyItem item) const
protectedvirtual

Definition at line 449 of file GroupedItemsProxyModel.cpp.

◆ span()

QSize GroupedItemsProxyModel::span ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractProxyModel.

Definition at line 254 of file GroupedItemsProxyModel.cpp.

◆ totalRowCount()

int GroupedItemsProxyModel::totalRowCount ( GroupedProxyItem parent = NULL) const
protected

Definition at line 457 of file GroupedItemsProxyModel.cpp.

Member Data Documentation

◆ m_defaultParent

GroupedProxyItem* GroupedItemsProxyModel::m_defaultParent
protected

Definition at line 194 of file GroupedItemsProxyModel.h.

◆ m_defaultParentGroup

int GroupedItemsProxyModel::m_defaultParentGroup
protected

Definition at line 202 of file GroupedItemsProxyModel.h.

◆ m_groupColumnIsProxy

bool GroupedItemsProxyModel::m_groupColumnIsProxy
protected

Definition at line 200 of file GroupedItemsProxyModel.h.

◆ m_groupColumnProxySrc

int GroupedItemsProxyModel::m_groupColumnProxySrc
protected

Definition at line 198 of file GroupedItemsProxyModel.h.

◆ m_groupColumnVisible

bool GroupedItemsProxyModel::m_groupColumnVisible
protected

Definition at line 199 of file GroupedItemsProxyModel.h.

◆ m_groupMatchRole

int GroupedItemsProxyModel::m_groupMatchRole
protected

Definition at line 197 of file GroupedItemsProxyModel.h.

◆ m_groupRowSelectable

bool GroupedItemsProxyModel::m_groupRowSelectable
protected

Definition at line 201 of file GroupedItemsProxyModel.h.

◆ m_groups

QVector<int> GroupedItemsProxyModel::m_groups
protected

Definition at line 196 of file GroupedItemsProxyModel.h.

◆ m_root

GroupedProxyItem* GroupedItemsProxyModel::m_root
protected

Definition at line 193 of file GroupedItemsProxyModel.h.

◆ m_rowsAreMoving

bool GroupedItemsProxyModel::m_rowsAreMoving
protected

Definition at line 203 of file GroupedItemsProxyModel.h.

◆ m_sourceMap

QHash<int, GroupedProxyItem *> GroupedItemsProxyModel::m_sourceMap
protected

Definition at line 195 of file GroupedItemsProxyModel.h.