BeginRemoveRows makes index invalid after the first item removed



  • 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?


Log in to reply
 

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