QConcatenateTablesProxyModel: Add getter for sourceModels

Currently, there's no generic way to get the source models as there's only
calls to add or remove them.

Change-Id: I23cdef7c93328b58a80ec4659b44073f8ff05088
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Kai Uwe Broulik 2019-11-14 15:19:17 +01:00
parent ede8545245
commit c2a13ae501
2 changed files with 12 additions and 0 deletions

View File

@ -447,6 +447,17 @@ QSize QConcatenateTablesProxyModel::span(const QModelIndex &index) const
return sourceIndex.model()->span(sourceIndex);
}
/*!
Returns a list of models that were added as source models for this proxy model.
\since 5.15
*/
QList<QAbstractItemModel *> QConcatenateTablesProxyModel::sourceModels() const
{
Q_D(const QConcatenateTablesProxyModel);
return d->m_models.toList();
}
/*!
Adds a source model \a sourceModel, below all previously added source models.

View File

@ -56,6 +56,7 @@ public:
explicit QConcatenateTablesProxyModel(QObject *parent = nullptr);
~QConcatenateTablesProxyModel();
QList<QAbstractItemModel *> sourceModels() const;
Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel);
Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel);