aboutsummaryrefslogtreecommitdiffstats
path: root/collectionsorter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'collectionsorter.cpp')
-rwxr-xr-xcollectionsorter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/collectionsorter.cpp b/collectionsorter.cpp
index 5c97761..4d33756 100755
--- a/collectionsorter.cpp
+++ b/collectionsorter.cpp
@@ -27,7 +27,7 @@ bool CollectionSorter::filterAcceptsRow(int sourceRow, const QModelIndex &source
}
void CollectionSorter::setFilter(QString filter)
{
- QModelIndex currentSelected = mapToSource(currentItem());
+ QModelIndex currentSelected = currentItem();
bool b = filter != m_filter;
m_filter = filter;
if(b)
@@ -39,7 +39,7 @@ QModelIndex CollectionSorter::peekNext() const
{
if(m_selected + 1 >= rowCount() || rowCount() == 0)
return QModelIndex();
- return index(m_selected + 1, 0);
+ return mapToSource(index(m_selected + 1, 0));
}
QModelIndex CollectionSorter::moveNext()
@@ -53,7 +53,7 @@ QModelIndex CollectionSorter::peekPrevious() const
{
if(m_selected <= 0 || rowCount() == 0)
return QModelIndex();
- return index(m_selected - 1, 0);
+ return mapToSource(index(m_selected - 1, 0));
}
QModelIndex CollectionSorter::movePrevious()
@@ -65,7 +65,7 @@ QModelIndex CollectionSorter::movePrevious()
QModelIndex CollectionSorter::currentItem() const
{
if(m_selected >= 0)
- return index(m_selected, 0);
+ return mapToSource(index(m_selected, 0));
return QModelIndex();
}
void CollectionSorter::setCurrentItem(const QModelIndex& item)
@@ -82,7 +82,7 @@ void CollectionSorter::setCurrentItem(const QModelIndex& item)
if(item.model() == this) {
m_selected = item.row();
m_parent->setPosition(mapToSource(item).row());
- } else if(item.model() == sourceModel() ) {
+ } else if(item.model() == m_parent) {
m_selected = mapFromSource(item).row();
m_parent->setPosition(item.row());
}