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

improvement to dataChanged() and layoutChanged() of QAbstractItemModel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.7
    • Core: Item Models
    • None

    Description

      There is some vagueness with the signal name dataChanged, its doc states that “This signal is emitted whenever the data in an existing item changes”, in fact it only tells the connected view that the data of the currently displayed items has changed(as said in this post), it is not emitted if the structure of the underlying data changes, this is the vagueness its name dataChanged brings, “the structure of the underlying data changes” is also actually one side of the data changes. The vagueness had brought problems to a lot of users.
      The Detailed Description section of the doc says if “the structure of the underlying data changes”, the layoutChanged() signal is the one being emitted, however, the concept of layout normally indicates that the basic structure (row and column count) remains unchanged, thus the name and the functionality of this signal don’t match, also caused some ambiguity.
      Perhaps a better improvement is to make dataChanged() also emitted if the structure of the underlying data changes. The next best option is to point out that to be notified if the structure of the underlying data changes go to use layoutChanged() and also point out the feature in the doc of layoutChanged() not just in the Detailed Description section of the doc. And use layoutChanged() rather than dataChanged() as an example in this tutorial.

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            philip Philip Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes