mirror of
https://github.com/status-im/SortFilterProxyModel.git
synced 2025-02-23 08:08:15 +00:00
Added a sourceData function
This commit is contained in:
parent
894ed218fe
commit
ff8e260e17
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user