Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.15.10
-
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.