Introduct mapRowToSource and mapRowFromSource

REVIEW: 105044
This commit is contained in:
Aurélien Gâteau 2012-05-25 14:33:56 +02:00
parent 0ddb12cf96
commit bb8eef7db1
2 changed files with 14 additions and 0 deletions

View File

@ -131,7 +131,17 @@ QVariantHash SortFilterModel::get(int row) const
return hash; return hash;
} }
int SortFilterModel::mapRowToSource(int row) const
{
QModelIndex idx = index(row, 0);
return mapToSource(idx).row();
}
int SortFilterModel::mapRowFromSource(int row) const
{
QModelIndex idx = index(row, 0);
return mapFromSource(idx).row();
}
DataModel::DataModel(QObject* parent) DataModel::DataModel(QObject* parent)
: QAbstractItemModel(parent), : QAbstractItemModel(parent),

View File

@ -99,6 +99,10 @@ public:
*/ */
Q_INVOKABLE QVariantHash get(int i) const; Q_INVOKABLE QVariantHash get(int i) const;
Q_INVOKABLE int mapRowToSource(int i) const;
Q_INVOKABLE int mapRowFromSource(int i) const;
Q_SIGNALS: Q_SIGNALS:
void countChanged(); void countChanged();