28 #ifndef GROUPEDITEMSPROXYMODEL_H 29 #define GROUPEDITEMSPROXYMODEL_H 31 #include <QIdentityProxyModel> 34 #include <QMetaMethod> 90 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
101 Q_INVOKABLE
void move (
int idx,
int pos,
int parent = -1);
113 qWarning() <<
"Can't get(int), source model not compatible";
124 qWarning() <<
"Can't get(QString), source model not compatible";
170 class GroupedProxyItem;
179 GroupedProxyItem *
itemForRow(
int row, GroupedProxyItem *
parent = NULL)
const;
183 virtual void removeItem(GroupedProxyItem *item);
206 bool setReloadSuspended(
bool enable) {
bool prev = m_reloadSuspended; m_reloadSuspended = enable;
return prev; }
207 bool reloadSuspended()
const {
return m_reloadSuspended; }
209 bool m_reloadSuspended;
252 #endif // GROUPEDITEMSPROXYMODEL_H virtual void modelResetHandler()
int m_groupColumnProxySrc
int groupColumnProxySrc() const
GroupedProxyItem(const QModelIndex &srcIndex, const bool isSrcItem=false, GroupedProxyItem *parent=NULL)
GroupedProxyItem.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
virtual GroupedProxyItem * findGroupItem(const int group, const QVariant &value=QVariant(), GroupedProxyItem *parent=NULL) const
QVariant data(const QModelIndex &index, int role=Qt::EditRole) const override
virtual void dataChangedHandler(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
QModelIndex index(int row, int column, const QModelIndex &parent) const override
GroupedProxyItem * m_parentItem
bool m_groupColumnVisible
virtual void setGroupMatchRole(int role)
bool m_groupColumnIsProxy
QModelIndex sourceIndex() const
virtual QModelIndex sourceIndexForProxy(GroupedProxyItem *item) const
bool isSourceItem() const
virtual void clearGroups()
Remove the previously-added groupings.
bool setData(const QVariant &data, int role=Qt::EditRole)
bool isValid() const const
void setSourceModel(QAbstractItemModel *newSourceModel) override
virtual void removeUnusedGroups(GroupedProxyItem *parent=NULL)
GroupedProxyItem * m_root
int groupRowSelectable() const
virtual GroupedProxyItem * itemForIndex(const QModelIndex &index, const bool rootDefault=false) const
GroupedItemsProxyModel(QObject *parent=Q_NULLPTR, QAbstractItemModel *sourceModel=Q_NULLPTR, const QVector< int > &groupColumns=QVector< int >())
GroupedItemProxyModel.
void move(int idx, int pos, int parent=-1)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
void removeChild(GroupedProxyItem *item)
Qt::ItemFlags flags(const QModelIndex &index) const override
QPersistentModelIndex m_sourceIndex
QMap< int, QVariant > m_itemData
virtual void setGroupColumnIsProxy(bool enable)
QObject * get(const QString &uid) const
virtual ~GroupedProxyItem()
GroupedProxyItem * parent() const
int groupColumnVisible() const
virtual uint extraColumns() const
virtual void removeGroup(int column)
Remove the previously-added column grouping.
int mapToSourceRow(int idx) const
QVariant data(int role=Qt::EditRole) const
int childRow(GroupedProxyItem *child) const
void removeChild(const int row)
GroupedItemsProxyModel allows a grouped item presentation of a flat table data model.
virtual void reloadSourceModel()
QVector< GroupedProxyItem * > m_childItems
QAbstractItemModel * sourceModel() const const
virtual void removeItem(GroupedProxyItem *item)
int groupMatchRole() const
QVector< GroupedProxyItem * > children() const
virtual void addGroups(const QVector< int > &columns)
Add multiple groupings based on columns.
GroupedProxyItem * child(const int row) const
void addGroup(int column)
Add a new grouping based on column.
bool isEmpty() const const
virtual void setGroupRowSelectable(bool selectable)
virtual void setGroupHeaderTitle(const QString &title, const QString &tooltip=QString())
virtual QModelIndex indexForItem(GroupedProxyItem *item, const int col=0) const
virtual void setGroups(const QVector< int > &columns)
Add multiple groupings based on columns.
QHash< int, GroupedProxyItem * > m_sourceMap
virtual void setGroupColumnVisible(bool visible)
virtual void rowsRemovedHandler(const QModelIndex &parent, int first, int last)
int totalRowCount(GroupedProxyItem *parent=NULL) const
GroupedProxyItem * m_defaultParent
int mapFromSourceRow(int idx) const
QObject * get(int idx) const
QString groupHeaderTitle() const
virtual void insertGroup(int index, int column)
Insert a new grouping at index based on column.
GroupedProxyItem * addChild(const QModelIndex &srcIndex, const bool isSrcItem=true)
virtual void setRootGroup(int column=-1, const QVariant &value=QVariant())
Sets parent group.
QMap< int, QVariant > itemData() const
virtual void rowsMovedHandler(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
virtual bool isProxyColumn(const QModelIndex &index) const
QObject * parent() const const
bool m_groupRowSelectable
virtual void rowsInsertedHandler(const QModelIndex &parent, int first, int last)
int groupColumnIsProxy() const
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QString toString() const const
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
bool setItemData(const QMap< int, QVariant > &roles)
virtual GroupedProxyItem * placeSourceRow(const int row)
QMap< int, QVariant > itemData(const QModelIndex &index) const override
virtual void setGroupColumnProxySrc(int column)
QHash< int, QByteArray > roleNames() const
const T value(const Key &key, const T &defaultValue) const const
GroupedProxyItem * itemForRow(int row, GroupedProxyItem *parent=NULL) const
~GroupedItemsProxyModel()
QSize span(const QModelIndex &index) const override