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

When dataChanged() is emitted with indexes indicating a range, then the whole viewport will be updated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.7.0
    • Widgets: Itemviews
    • None

    Description

      When dataChanged() is emitted with indexes indicating a range, then the whole viewport will be updated as the range is not taken into consideration. If only a single index is covered by the "range" indicated in the emitted signal then it only updates that index.
      Attached is an example that reproduces the problem, the signal is emitted with only rows 2-3 in the range yet all of the rows are updated.

      I have seen this problem QTreeView, it may happen with other view classes as well.

      This seems grossly inefficient.
      This could probably be fixed by forming a rectangle containing the begin and end elements of the range, and invalidating that rectangle.

      ( Modified from bug report https://bugreports.qt.io/browse/QTBUG-13668 )

      The guilty code is in QAbstractItemView::dataChanged(),
      where an if branch on 'topLeft == bottomRight' is done.
      If false, d->viewport->update() is called.

      Attachments

        1. main.cpp
          1 kB
          Nicholas Chapman

        Issue Links

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

          Activity

            People

              mmutz Marc Mutz
              NChapman Nicholas Chapman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes