23 : QAbstractProxyModel(parent)
35 disconnect(sourceModel(), &QAbstractItemModel::dataChanged,
this,
37 disconnect(sourceModel(), &QAbstractItemModel::rowsInserted,
this,
39 disconnect(sourceModel(), &QAbstractItemModel::rowsRemoved,
this,
43 QAbstractProxyModel::setSourceModel(model);
46 connect(sourceModel(), &QAbstractItemModel::dataChanged,
this,
48 connect(sourceModel(), &QAbstractItemModel::rowsInserted,
this,
50 connect(sourceModel(), &QAbstractItemModel::rowsRemoved,
this,
74 if (!proxyIndex.isValid())
82 if (!sourceIndex.isValid())
90 QModelIndex sourceParent;
94 QMapIterator<QPersistentModelIndex, QPersistentModelIndex> it(
96 while (it.hasNext()) {
98 if (it.value() == sourceParent && it.key().row() == row && it.key().column() == column)
101 return QModelIndex();
106 QModelIndex sourceParent =
m_proxyStrategy->proxySourceParent().value(child);
107 if (sourceParent.isValid())
110 return QModelIndex();
115 QModelIndex sourceParent;
118 QMapIterator<QPersistentModelIndex, QPersistentModelIndex> it(
122 while (it.hasNext()) {
124 if (it.value() == sourceParent)
125 rows.insert(it.key().row());
140 if (
parent.isValid() && !source_parent.isValid())
147 const QModelIndex& bottomRight,
148 const QVector<int>& roles)
150 ASSERT(topLeft.isValid() ? topLeft.model() == sourceModel() :
true);
151 ASSERT(bottomRight.isValid() ? bottomRight.model() == sourceModel() :
true);
154 if (item->modelType() ==
"GroupProperty")
#define ASSERT(condition)
Defines class ComponentProxyModel.
Defines class ComponentProxyStrategy.
Defines ModelUtils namespace.
Defines class SessionModel.
ComponentProxyModel(QObject *parent=nullptr)
std::unique_ptr< ProxyModelStrategy > m_proxyStrategy
int rowCount(const QModelIndex &parent={}) const
QModelIndex index(int row, int column, const QModelIndex &parent={}) const
void setRootIndex(const QModelIndex &sourceRootIndex)
void setProxyStrategy(ProxyModelStrategy *strategy)
QModelIndex parent(const QModelIndex &child) const
bool hasChildren(const QModelIndex &parent) const
void buildModelMap()
Main method to build the map of persistent indeses.
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
void sourceRowsRemoved(const QModelIndex &parent, int start, int end)
int columnCount(const QModelIndex &parent={}) const
QModelIndex mapToSource(const QModelIndex &proxyIndex) const
void setSessionModel(SessionModel *model)
void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles={})
void sourceRowsInserted(const QModelIndex &parent, int start, int end)
Strategy for ComponentProxyModel which hides extra level of GroupProperty.
Base class for proxy strategies in ComponentProxyModel.
SessionItem * itemForIndex(const QModelIndex &index) const