View Full Version : QGraphicsScene - incorrect redrawing of dashed lines

19th January 2013, 09:50

I faced with the problem: when moving one item above the other - dotted lines are redrawn incorrectly (QPen::setDashPattern (http://qt-project.org/doc/qt-4.8/qpen.html#setDashPattern), cosmetic (http://qt-project.org/doc/qt-4.8/qpen.html#isCosmetic)=true). The bounding rect seems calculated correctly.


The problem can work around by setting the QGraphicsView::FullViewportUpdate (http://qt-project.org/doc/qt-4.8/qgraphicsview.html#ViewportUpdateMode-enum) or using QGLWidget as viewport, but on old PC both ways noticeably slow down drawing.

The effect also disappears if disable cosmetic. But then it would have to dynamically change pen width on zoom. (And the line looks worse).

Qt versions: 4.7.4, 4.8.4 (mingw 4.6.3); 5.0.0 (msvc2010). Win7x64/XPx86.
On 4.8.4 the effect more visible.

Simple test project: 8596

Thanks for help.