Hi, how can I draw lines with smooth edges in QGraphicsView? I have strait dash line with 6px width and it looks really sharp and bad.
Hi, how can I draw lines with smooth edges in QGraphicsView? I have strait dash line with 6px width and it looks really sharp and bad.
You need to change :
Qt::PenCapStyle
Qt::PenJoinStyle
If you mean the angled line looks "jagged" when drawn at an angle you'll need to turn on "antialiasing" in the QGraphicsView e.g.
Qt Code:
To copy to clipboard, switch view to plain text mode
Matthew.
JaRo999 (27th September 2009)
Thank You both fot replies. Yogeshgokul - I was using that options already before I've wrote the post. Unfortunately they are not the way for "transition effect" between line and background. Burnttoy's code did the trick, however now some lines that should be black are gray - another problem to solve for the future![]()
That's the way antialiasing works - it blurs the edges of the lines so if you have a black line with thickness of "1" it will become a black line with a thickness of "1" surrounded by two gray lines with a thickness of "1" each resulting in a gray line with a thickness of "3". It's either that or aliased lines.
Bookmarks