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

Changing value of roleNames() between begin- and endResetModel() leads to extra invalid elements in view

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • 6.8
    • 6.7.3
    • None
    • Linux/Wayland, Windows

      The QAbstractListModel class has an issue when dealing with dynamic role names that are not known at the time of model creation. This problem occurs in scenarios where both the model data and role names are updated after the class instantiation.

      The roleNames() function, which provides the role names for the model, can be modified by the programmer between calls to beginResetModel() and endResetModel(). When this is done happens, it leads to an unexpected behavior in QML rendering.

      The primary manifestation of this bug is the appearance of duplicate elements when the model is rendered in QML views.

      Use this code to reproduce: https://github.com/hymatek/qt-list-model

      Observed bug is duplicate elements:

      The undesired behavior can be circumvented by updating the role names before the model reset.

       

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            hornang Stig Hornang
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes