[Qt-qml] QSortFilterProxyModel: sorting becomes broken when adding list item and filtering is enabled

Michael Nosov michael.nosov at gmail.com
Mon Jan 31 10:24:55 CET 2011


Hello, everyone,
I'm using QML ListView to display model data. My C++ model is derived from
QSortFilterProxyModel.
Seems that sorting of QSortFilterProxyModel is broken when I'm enable
filtering, then adding some data to model, and then disable filtering
I've prepared sample to reproduce the issue based on Qt's
'examples/declarative/modelviews/abstractitemmodel' example.

Test 1 (correct behavior):
==================
- Run 'abstractitemmodel'. You'll see list with 'Animal1, Animal4, Animal8'
- Click on 'Add animal' button.
- You'll see correctly sorted list (Animal1, Animal4, Animal7, Animal8)

Test 1 (INCORRECT behavior):
==================
- Run 'abstractitemmodel'. You'll see list with 'Animal1, Animal4, Animal8'
- Enter 'q' in filter text input. You'll see the empty list
- Now click on 'Add animal' button.
- Clear text input by clicking 'Clear...' button.
- You'll see INcorrectly sorted list (Animal1, Animal8, Animal4, Animal7) -
this list is totally not sorted

I'm having Qt 4:4.7.0-0ubuntu4.2 on my desktop, but it seems that the bug is
also applicable for other qt versions (4.7.1, etc.)

Can you please provide your feedback regarding this issue? Maybe suggest
some workaround for this?

Thanks a lot in advance,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110131/e8ce2c81/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: abstractitemmodel.zip
Type: application/zip
Size: 8751 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110131/e8ce2c81/attachment-0001.zip 


More information about the Qt-qml mailing list