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

Flickering in QListView when appending items if VerticalScrollBarPolicy == Qt::ScrollBarAlwaysOff

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.0, 5.12.1, 5.12.2, 5.12.3
    • Widgets: Itemviews
    • None
    • Linux/X11

    Description

      I have a QListView whose model is getting items appended from a worker thread via a queued signal-slot connection. While items are being appended to the QListView, the viewport flickers. I assume a lot of (unnecessary) repaints are being done.

      When I comment out the call to QListView::setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) the listview behaves normally as expected.

      Since the contents of the viewport do not change (after it is initially filled) and no scrollbar is being drawn, I would assume setting QListView::setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff) would cause less repaints.

      Attached is a video showing first the behavior with a scrollbar present, then the faulty behavior without a scrollbar. Also the code used in the video is attached, it should compile with qmake -project QT+=widgets && qmake && make.

      Also, please advise me any workarounds to this problem as I would like to keep my project going.

      EDIT
      In case it's useful, I added two callgrind files, one with flickering (without scrollbar) 'callgrind.out.2523.BAD', and one withour flickering (with scrollbar) 'callgrind.out.2561.GOOD'.

      Attachments

        1. callgrind.out.2523.BAD
          1.71 MB
        2. callgrind.out.2561.GOOD
          1.74 MB
        3. main.cc
          1.0 kB
        4. myitemmodel.h
          1 kB
        5. output2.mp4
          552 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            bastimmer Bas Timmer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes