Reputation: 309
I am trying to draw a rectangle with big stroke width(set by a QPen) and QPainter is drawing the rectangle but all of the corners are a little cut out, not as sharp as they ought to be. Here is an image: https://i.sstatic.net/omAdY.png
I'm drawing it on top of a QWidget using this code:
m_painter.drawRect(upLeftX, upLeftY, downRightX - upLeftX, downRightY - upLeftY);
Upvotes: 2
Views: 1282
Reputation: 12879
Moved from comment.
You can set the pen's join style easily using QPen::setJoinStyle
. To modify the pen currently in use by the QPainter
use something like...
QPen pen = m_painter.pen();
pen.setJoinStyle(Qt::MiterJoin);
m_painter.setPen(pen);
Upvotes: 2