on xenial help sign in
Added mapToSource mapFromSource
f4717efNick Dedekind
plugins/Utils/qsortfilterproxymodelqml.cpp+20
@@ -121,3 +121,23 @@ QSortFilterProxyModelQML::findFirst(int role, const QVariant& value) const
121 return -1;
121 return -1;
122 }
122 }
123}
123}
124+
125+int
126+QSortFilterProxyModelQML::mapFromSource(int row)
127+{
128+ if (sourceModel() != NULL) {
129+ return QSortFilterProxyModel::mapFromSource(sourceModel()->index(row, 0)).row();
130+ } else {
131+ return -1;
132+ }
133+}
134+
135+int
136+QSortFilterProxyModelQML::mapToSource(int row)
137+{
138+ if (sourceModel() != NULL) {
139+ return QSortFilterProxyModel::mapToSource(index(row, 0)).row();
140+ } else {
141+ return -1;
142+ }
143+}
plugins/Utils/qsortfilterproxymodelqml.h+3
@@ -45,6 +45,9 @@ public:
45 void setModel(QAbstractItemModel *model);
45 void setModel(QAbstractItemModel *model);
46 void setInvertMatch(bool invertMatch);
46 void setInvertMatch(bool invertMatch);
47
47
48+ Q_INVOKABLE int mapFromSource(int row);
49+ Q_INVOKABLE int mapToSource(int row);
50+
48Q_SIGNALS:
51Q_SIGNALS:
49 void totalCountChanged();
52 void totalCountChanged();
50 void countChanged();
53 void countChanged();