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

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

XMLWordPrintable

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

      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'.

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

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

              Created:
              Updated:

                There are no open Gerrit changes