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

QTreeView calls unnecessary fetchMore when sort is called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 3.x, 4.5.3, 4.6.2
    • Widgets: Itemviews
    • None

    Description

      In QTreeViewPrivate::layout function, we have the following code :

      if (model->hasChildren(parent))

      { if (model->canFetchMore(parent)) model->fetchMore(parent); count = model->rowCount(parent); }

      So when sort by column, the view requests to fetch more data from the model, but this is not necessary and even harmful when the model has a large amount of data and uses canFetchMore / fetchMore to provide data to the view.
      As mentioned in our document for canFetchMore that "If canFetchMore() returns true, QAbstractItemView will call fetchMore(). However, the fetchMore() function is only called when the model is being populated incrementally."
      So it's more reasonable that we remove these lines.
      BTW, removing these lines doesn't influence the sorting function.

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes