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

QML TableView performance issue during scroll

    XMLWordPrintable

Details

    • 8a0f0553e4eb8468513bbb8ba45a9ec2bcd6ce68

    Description

      Hello,

      When there are a few rows/columns (but not that many, I tested it with 300 items and 12 columns) in a QML TableView, the associated performance of a scroll are generally bad, with frame drops and little freezes.

      When looking at the source of the internal delegate of TableView, TableViewItemDelegateLoader.qml, we can see the following code:

      Loader {
          id: itemDelegateLoader
      
          // ...
          sourceComponent: __model === undefined || styleData.row === -1 ? null
                           : __column && __column.delegate ? __column.delegate : __itemDelegate
      }
      

      We can see here that the sourceComponent property depends on styleData.row. Since delegates are reused in QML TableView, this property (styleData.row) changes a lot during scrolls, leading to creation and destruction of delegates, and lags.

      Technically, the sourceComponent property effectively creates/destroys a component only on change of the QQuickComponent, so it should not do anything, BUT It appears that styleData.row is frequently set to -1 during scroll (when reusing components, it changes), leading to component creations/destruction.

      By changing the code to:

      Loader {
          id: itemDelegateLoader
      
          // ...
          sourceComponent: __model === undefined ? null
                           : __column && __column.delegate ? __column.delegate : __itemDelegate
      }
      

      I don't see any visual change/error and I don't see the lags anymore (at least not with this amount of data). It's probably not the right way to fix it, but can something be done about this?

      Thanks,
      Louis

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            louisduverdier Louis DUVERDIER
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes