[Qt-qml] Problems with ListView section headings after adding new element to list

Bo Elmgreen bo.elmgreen at gmail.com
Wed May 25 12:48:33 CEST 2011


Resending mail as I suspect the first one wasn't sent out to the mailing
list...
----------------------------

Hi all,

I am using a QML ListView to show some users (individuals) and some groups,
and I use the ListView section properties for grouping the list content.
The underlying model is a subclassed QAbstractListModel, and I sort the
elements using a QSortFilterProxyModel on top of my model class, which I
expose to QML via a context property. The sorting is implemented in the
lessThan method of the sub-classed QSortFilterProxyModel class, and first I
sort on the section property (individual/group) and then on the name.

This works fine initially, but if I at run-time add a new user, the list is
sorted correctly, but the section headings are corrupted, see the attached
screen dumps.

I stumbled across a bug (http://bugreports.qt.nokia.com/browse/QTBUG-17606),
which looks related, but I don't know if it really has the same root cause
or whether the fix also solves my problem. Please advise if I am missing
something, or if there is a work-around to this problem.

Thanks,
Bo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110525/58d5a778/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listAfterAddingUser.png
Type: image/png
Size: 21957 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110525/58d5a778/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listBeforeAddingUser.png
Type: image/png
Size: 19250 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110525/58d5a778/attachment-0003.png 


More information about the Qt-qml mailing list