When a widget with the WA_PaintOnScreen flag is updated via QWidget::update(), paint events on sibling widgets are omitted.
- Use one of the following test apps:
- Launch the test app.
- Click on the top widget and move the mouse pointer; the widget's background will change color as the mouse position changes.
- After 5 seconds, the bottom widget will be updated, and the top widget will stop repainting (see attached video PaintOnScreenIssue.mp4).
A more technical description:
When QWidget::update() is called, a QEvent::UpdateRequest event is posted to the widget (or top level widget), and the QWidgetBackingStore::updateRequestSent private member is set, to avoid sending another event until the previous one has been processed. When the event is received, QWidgetBackingStore::sync() is invoked, and the private member is cleared, so that another update event can be posted.
However, if the widget has been marked with Qt::WA_PaintOnScreen, QWidgetBackingStore::sync() is never invoked; the private member is never cleared. The backing store is typically shared with top level windows and its children. Because the private member is not cleared at the expected time, paint events are skipped, and widgets stop repainting.