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. BeginRemoveRows makes index invalid after the first item removed

BeginRemoveRows makes index invalid after the first item removed

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 3.9k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Deqing
    wrote on last edited by
    #1

    Hi there,

    I'm using a QList to store my data, and display it via QML.

    Just found that when I remove the first data, the index of the list will be invalid...

    For example, if I do:
    @
    int index = 0;
    beginRemoveRows(QModelIndex(), index, index);
    mylist.removeAt(index);
    endRemoveRows();
    @

    then if I try to get the first item of the list, it returns -1; the second one returns 0 ...

    Not sure if any one is seeing the same issue?

    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