The attached source code represents a minimal repeatable case.
The case is the following:
QMainWindow contains QGraphicsView as a center widget.
The are also dock widgets with QTreeViews.
The redraw problem is easily reproducible if you grab either left or right dock widget's resize bar and start moving it.
On the real project it also occurs when window becomes inactive.
The issue is caused by the push button widget. It occurs only if it is visible in the view. If you scroll the view and hide it, everything is ok.
An important factor is that the button lies before all other elements on the scene (in terms of Z-order). And incorrect drawing occurs only for the items that lie after.
Also note that the text is drawn as a polygon, not as spline or something. Maybe that will help in discovering the problem.
The issue is not reproduced in Qt 5.6 and earlier.
Here is fragment of source code:
|For Gerrit Dashboard: QTBUG-56282|
|200843,1||Revert "QWidget: Update systemClip restore"||5.9||qt/qtbase||Status: DEFERRED||0||0|
|200887,3||QWidget::render(): Add a call to QPaintEnginePrivate::systemStateChanged()||5.9||qt/qtbase||Status: MERGED||+2||0|