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

[macOS] QScrollBar painting gradually slowing down



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.1, 6.0.3, 6.1.2
    • Fix Version/s: None
    • Labels:
    • Environment:
      OS: macOS Catalina 10.15.7 19H524
      Compiler: Apple clang version 12.0.0 (clang-1200.0.32.29), for x86_64-apple-darwin19.6.0
      Platform SDK: 11.1
    • Platform/s:


      When repeatedly scrolling in a QTableView, QTableWidget, QListWidget or a QListView, a QScrollBar drawn with a native Mac style will slow down the paint performance significantly over time. This performance "rot" is associated with an increase in RAM. When the window receives a mouse or keyboard event, after a short lag the paint performance returns to normal. The length of lag is correlated with the paint time. It doesn't seem to make any difference whether the window is active or not, as long as it is visible and repainting.

      The attached minimal example is a QTableWidget that scrolls randomly to cells every 10ms. Paint performance on the QTableWidget is timed for each paint and displayed, averaged over 20 paints. 

      In typical performance on my machine, the example starts with average paint times of around 2-4ms. After 4 minutes the average paint time is around 75ms. Once the window is clicked, or a key is pressed, after a short lag, the performance returns to initial speed before starting to climb again. 

      On the other hand, without QScrollBars or when using the "Fusion" theme, the paint performance stays relatively constant, as expected. To see this, use the "-w" flag when running. (See lines 94 & 95 in main.cpp)

      A .png showing a graph is attached.

      NB: I have tested this with QTableView, QTableWidget, and QListWidget. The System Preferences/General/Show scroll bars setting seems to have no impact on the example. I have not been able to replicate this behaviour with a QPlainTextEdit, except for the lag. The lag has also been present in my own app even with scrollbars off— perhaps this requires further investigation.

      EPILEPSY WARNING The example has very fast repeated scrolling.


        1. QScrollBar bug report.zip
          2 kB
        2. qtdiag.txt
          5 kB
        3. Typical performance.png
          Typical performance.png
          418 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            vestbo Tor Arne Vestbø
            spookytac Isaac Hayward
            0 Vote for this issue
            1 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes