diff --git a/qqmlsortfilterproxymodel.cpp b/qqmlsortfilterproxymodel.cpp index eb0ae00..4e339dd 100644 --- a/qqmlsortfilterproxymodel.cpp +++ b/qqmlsortfilterproxymodel.cpp @@ -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); diff --git a/qqmlsortfilterproxymodel.h b/qqmlsortfilterproxymodel.h index 75fbd5b..9444217 100644 --- a/qqmlsortfilterproxymodel.h +++ b/qqmlsortfilterproxymodel.h @@ -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();