Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.7.0
-
All platforms
-
eef70912bf7b0d25c07122f39cc8f819c6e351eb (qtbase/5.9, 3.8.2017, 5.9.2)
Description
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:
#define WIDTH 200 #define HEIGHT 100 void MainWindow::PopulateScene() { //Important condition - widget should be before all other items (Z-order) auto pButton = new QPushButton("Button"); auto pButtonProxy = m_pScene->addWidget(pButton); pButtonProxy->setPos(WIDTH * 10, HEIGHT * 10); for (size_t i = 0; i < 20; i++) { for (size_t j = 0; j < 20; j++) { // Text is big enough to cover the entire rectangle auto pRect = m_pScene->addRect(QRectF(0, 0, WIDTH, HEIGHT)); auto pText = m_pScene->addSimpleText("LongText"); auto qFont = pText->font(); qFont.setPointSize(40); pText->setFont(qFont); pText->setParentItem(pRect); pRect->setPos(j * WIDTH, i * HEIGHT); } } }
Attachments
Issue Links
- relates to
-
QTBUG-55698 [REG 5.6.1->5.7.0]: When resizing a QMdiSubWindow that has a QGraphicsView in it, parts of the scene are drawn outside of the subwindow
-
- Closed
-
- resulted from
-
QTBUG-44067 Widgets are wrongly clipped when rendered through multiple proxy widgets
-
- Closed
-