PDA

View Full Version : QSortFilterProxyModel and get correct data



Benecore
4th February 2013, 13:34
Hi quys :D

First sorry my English, hope you understand me.

"Problem":
I need use QSortFilterProxyModel on my QML mobile apps. That's ok. Everything works fine, sorting, filtering all works, but my problem is that i cannot get correct data from item.

For example:
I have 4 items with some TITLE. Where are all displayed on the ListView then when i click on item, then show me (console.debug) TITLE of item according index. That's OK.
The problem occurs when i use filtering then is (for example) displayed only 2 items, but the TITLE is same as before.

EXAMPLE LIST
ITEM 1
ITEM 2 - click, print ITEM 2
ITEM 3
ITEM 4

FILTERING ENABLED
ITEM 1
ITEM 4 - click, print me still ITEM 2

I tried some examples of finished, one of them is this with small change
8679
source from http://www.developer.nokia.com/Community/Wiki/Incremental_Search_with_Qt

Thank you for answer, hope you understand me :)

Benecore
5th February 2013, 13:48
Solved :D, but another problem. When i use filtering then rowCount value is wrong or is still like full items value. Is there a solution?
THX