Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [solved] Updating ListView sections when inserting items
QtWS25 Last Chance

[solved] Updating ListView sections when inserting items

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 978 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Faid
    wrote on last edited by
    #1

    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..

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved