Added a sourceData function

This commit is contained in:
oKcerG 2016-10-12 00:06:39 +02:00
parent 894ed218fe
commit ff8e260e17
2 changed files with 14 additions and 0 deletions

View File

@ -113,6 +113,17 @@ void QQmlSortFilterProxyModel::componentComplete()
invalidate();
}
QVariant QQmlSortFilterProxyModel::sourceData(const QModelIndex& sourceIndex, const QString& roleName) const
{
int role = sourceModel()->roleNames().key(roleName.toUtf8());
return sourceData(sourceIndex, role);
}
QVariant QQmlSortFilterProxyModel::sourceData(const QModelIndex &sourceIndex, int role) const
{
return sourceModel()->data(sourceIndex, role);
}
bool QQmlSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
{
QModelIndex modelIndex = sourceModel()->index(source_row, 0, source_parent);

View File

@ -53,6 +53,9 @@ public:
void classBegin() override;
void componentComplete() override;
QVariant sourceData(const QModelIndex& sourceIndex, const QString& roleName) const;
QVariant sourceData(const QModelIndex& sourceIndex, int role) const;
signals:
void countChanged();