Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39279

ListModel : rowsAboutToBeRemoved is emitted after the row's removal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.3.1
    • 5.3.0
    • None
    • ALL
    • qtdeclarative#stable: 0306626a4deb8c36b219ba08a68248d3a454b697

      According to the document of QAbstractItemModel , the rowsAboutToBeRemoved should be emitted before the rows are actually removed. Therefore , the rows should be still accessible.

      However, I found that the implementation of ListModel (QQmlListModel) does not follow the rule. The rows are already removed when you got the rowsAboutToBeRemoved signal.

      The expected program flow:

      QQmlListModel::remove()
      --> emit rowsAboutToBeRemoved
      --> remove the data
      --> emit rowsRemoved

      The actual program flow

      QQmlListModel::remove()
      --> remove the data
      --> emit rowsAboutToBeRemoved
      --> emit rowsRemoved

      There has same problem for rowsAboutToBeInserted and rowsAboutToBeMoved.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            benlau Ben Lau
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes