Unsolved QGraphicsView drawing artifacts
-
Hi,
I am working on an application, based on a graph editor, which uses a QGraphicsView. Sometimes, when dragging the view, some strange artifacts appear, inside and even outside the widget :
It is quite annoying, and I don't see what I can do to remove them.
I tried to play with the render options, but I can see no change. I also tried to use a QGLWidget for the viewport, which seems to remove them, but it causes other troubles, and I don't want the opengl dependancy.My items are quite standard, especially the one that seems to be the cause, the connection item : it is just a QGraphicsItemGroup with 3 QGraphicsPathItem as children. I also embed many QGraphicsProxyWidgets, but they seem to work fine after setting their bounding rect correctly.
Any idea on what I can do to fix this ?
If you want to test it, the whole code is on github :
https://github.com/wawanbreton/cvcomposerThanks !
-
Hi and welcome to devnet,
Which version of Qt are you using ? On what version of Windows ?
-
Hi,
I am using Qt 5.7.0 with mingw-32 on Windows 7.
I can try other versions of Qt it that may help, and even the Linux version. -
IIRC, there's 5.8 Beta that is available.
You can also test the latest 5.6 to see if it's a regression.Just tested it on Mac and I'm not able to reproduce that problem.
What graphic card do you have on your machine ?
-
Hi,
Sorry for the delay !
I tried today with a 5.5 version, provided mingw and same platform, and actually it works well ! Now I should try with 5.8 as you suggested, to see if the issue has been fixed in the meantime. -
Well, compiling Qt on Windows is quite a pain.. Can I find binaries of 5.8 somewhere ?
-
The snapshot of the Beta can be found here.
-
Thank you for the link, I will keep it somewhere :)
Well, the artifacts are still presents in 5.8 Beta (tag number 584), do you want me to test other versions, for example the msvc one ? -
One more thing you can test is forcing the use of Desktop OpenGL. See here for the variable to set and how (no need to re-build Qt though).
-
Hi, I tried the various values of the QT_OPENGL variable, but nothing changes. Actually, I'm not using a QGLWidget for the QGraphicsView. I tried to : it does remove the artifacts, but generates other limitations, on antialiasing for example, so I'd like to keep the "non-opengl" implementation.
-
Then it's likely a Windows specific issue, you should take a look at the bug report system to see if its something known.
-
I can't find something similar, I will create a new bug.
Thank you for the support. -
Thanks ! Don't forget to share the link to the report, it will make it easier to find.
-
Here is the bug link :
https://bugreports.qt.io/browse/QTBUG-56517I think I will try to make a minimal project to reproduce the bug, I know it helps developpers :)
-
@wawanbreton
A minimal project is very helpful ! - as it allows developers to easily reproduce
the bug, so please do! :) -
Hi,
I finally had time to add a project. The bug can be reproduced by starting the application and just play a bit with the mouse (I detailed the instructions in the bug report).
Now I hope someone has time to work on it :) -
@wawanbreton
Its a good idea to post link to bug report here as
people searching the forums can go vote for the issue. -
I had the same problem, it took a long and frustrating amount of time to try and fix, but I think that I have found a solution.
Inside my paint function for that graphicsItem I created a region, then set clip region.
QRegion r1(QRect(-40, -40, 400, 200));
painter->setClipRegion(r1);
This may cause some other problems later, but I haven’t come across them yet. And I’m not sure on the performance cost of doing this when you have a large number of items on the screen. I think that I will move the creation of the region to outside of paint to start with.