[solved] Updating ListView sections when inserting items



  • I'm showing public transport times in a listview and as sections I use the start date of each trip, so for each new date I get a new section. This works great when appending items to the model when requesting more (later) trips - I just append the times and if there is a new date, the listview adds a new section. However, if I insert items to the start of the listview (if the user requests earlier times), then the section for that date is not moved to the top, instead it stays on top of the item that was previously at the top of the list.

    Is it possible to work around this behavior? I'm using Qt 4.7.4 on the Nokia N9 so unfortunately I don't have the option of testing on later versions.

    Edit:
    To better illustrate the issue, here are some screenshots. In the second image the items at the top have been inserted at index 0 in the list model, and even though they are shown above the section header they actually belong under it:
    http://img864.imageshack.us/img864/793/20120719101321.png
    http://img801.imageshack.us/img801/841/20120719101426.png

    Edit2:
    Found the error in my code..


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.