Custom dash pattern
I have a custom dash pattern that I have which i use to draw the outline of a box of variable size. The setting up of the line is as follows:
@QVector< qreal > dashes;
qreal space = 6;
qreal dashWidth = 4;
dashes << dashWidth << space;
However when i am zooming using QGraphicsView, the dashes seems "cycle" around the border which i do not want. Is there a way which i remove the "cycling" effect?
I doubt this has anything to do with your custom dash pattern. Have you tried it with the standard dash pattern? Does it behave the same?
Yes, the standard dash pattern behaves the same
I assume this behavior is by design: The length of line segments and gaps is the same regardless of the zoom level.
However, if you have, for example, a rectangle, the total length of the circumference is different depending on zoom level. If the total line length changes, then the end of the line might show a gap where before it showed a line segment.
There is no clean solution. If what you want is a dashed line where the dash length changes with the zoom level, you need to do that with the geometry of the graphic object you use, not with a dash pattern.