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

Widget stops being updated when setUpdatesEnabled(false) is called before setUpdatesEnabled(true) is completed

    XMLWordPrintable

Details

    • b4653636a (dev)

    Description

      When the following processe occurs sequentially, the main widget will stop being updated.

      1. An UI event occurs
      2. Stop screen update by QMainWindow::setUpdatesEnabled(false)
      3. Waiting for image generation by updating various screen parts and asynchronous processing
      4. After completing the process, restart the screen update with QMainWindow::setUpdatesEnabled(true) and update the full screen
      Then, if the next #1 occurs immediately after (almost at the same time) the #4, QMainWindow will not be updated any more.

      By debugging, it was found that in QWidgetRepaintManager::markDirty, dirtyWidgets is not empty and updateTime is UpdateLater, so no update event is emitted.

      More technical description
      The process goes QMainWindow::setUpdatesEnabled(true) → QWidget::update → QWidgetRepaintManager::markDirty and then post the update event. However, QMainWindow::setUpdatesEnabled(false) by the next UI event is inserted before the posted event. As a result, QWidget::updatesEnabled becomes false by the time QWidgetRepaintManager::paintAndFlush is executed, and even if the event is canceled, the flag that the event has been issued remains, so the screen update is not executed.

      How to reproduce
      1. Open and run the attached example
      Left click issues one UI event and Right click issues 100 UI events in such an interval which likely to cause this problem.
      2. Right mouse click a couple of times. The widget stops being updated.

      The problem can be avoided by calling repaint() right after setUpdatesEnabled(true) in the sample code.
      However, since re-enabling (setUpdatesEnabled(true)) claims to update the widget, it should not be needed.

      Attachments

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

        Activity

          People

            axelspoerl Axel Spoerl
            nagrohn Nahomi Gröhn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 1 hour
                1w 1h

                Gerrit Reviews

                  There are no open Gerrit changes