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

Resizing and moving of QMdiSubWindows creates massive CPU load (up to 100%), when the Subwindow contains a TableView class.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • Some future release
    • 4.6.3, 4.7.1
    • Widgets: Itemviews
    • None
    • Ubuntu 10.04 32bit. Qt 4.7.1 (also tested with 4.6.3) compiled from source. GCC 4.4.3.

    Description

      Resizing and moving of QMdiSubWindows creates massive CPU load (up to 100%), when the Subwindow contains a TableView class.

      My setup: A QMdiArea contains one (or more) QMdiSubWindow(s). The QMdiSubWindow contains a QTableView. My Model is a simple subclass of QAbstractTableModel. Access to the data() function of the model is O(1). I have attached a simple test program to show the problem. In this test program I have added a qDebug() statement to show all accesses to the data() function.

      Main bug:
      Now when the subwindow is moved around or resized, a lot of the visible cells and sometimes even all visible cells get rerendered for each mouse event (here you might want to try the test program). For example, when the RubberBandMove option is set to true and the subwindow is moved, all visible cells of the underlying window that are within the rubberband are completely rerenderd for each mouse event (e.g. each pixel that the mouse is moved). This rerendering also includes accesses to the models data() function for all rerendered cells. This creates a lot of CPU load. Similar things happen, when the SubWindow is resized: For each mouse event all visible cells get completely rerendered.

      A second (probably related) bug:
      The TableView also rerenderes all of its visible cells each time you click on the titlebar of the subwindow.

      This behavior is bad for the following reasons:
      -CPU load easily goes to 100% when bigger windows are moved/resized (in my case around 500 visible cells per window)
      -The bigger the visible table gets, the worse the problem becomes
      -All of this rerendering is completely unnecessary
      -A lot of unnecessary accesses to the models data() function are generated. This might might make things worse, if the model accesses some database over a network.

      Side notes:
      -The problem can be varied in intensity by setting RubberBandMove and RubberBandResize options of the subwindow.
      -This problem only occurs, when the TableView is part of an QMdiSubWindow. If it is an independent Window on the desktop (see additional lines in main.cpp for a comparison), then there is no unnecessary rerendering or access to the models data() function at all.

      I believe this has something to do with the event system and window behavior of the QMdiArea. A MdiSubWindow should contain (and probably already does) some kind of pixelbuffer of its content, which can be copied to the screen whenever it is moved/resized or when a part of the window it gets shown on the screen (e.g. when another window is moved away on top of it).

      If you have any questions, you can also call me under 0049 241 5683669

      Kind regards,
      Thomas Bretgeld
      GLP GmbH

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            bretgeld Thomas Bretgeld
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes