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

QML ListView's currentIndex and currentItem are not updated properly

XMLWordPrintable

      When inserting list elements at the beginning of the model, currentItem and currentIndex are not updated, so we have an invalid state where currentItem is still pointing to previous one, but as we are adding elements at the beginning, both properties should be updated.

      Redefining the currentIndex after updating the model, fixes the issue. The small attached QML example shows the issue and the workaround to fix it.

        1. main.qml
          2 kB
        2. workaround.patch
          0.5 kB
        3. Demo.qml
          2 kB
        For Gerrit Dashboard: QTBUG-131646
        # Subject Branch Project Status CR V

            mhqanbari MohammadHossein Qanbari
            cidorvan Cidorvan Leite
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes