QPainter and drawing stroke inside/outside/middle of the path
-
Had you try to refer to the Qt Documentationof QPainter?
-
Had you try to refer to the Qt Documentationof QPainter?
@Charlie_Hdz, yes but not helped me.
-
To be concrete, QPainter won't solve your problems, I know, it's kind of counterintuitive, but what really is important is to handle the QPaintEvent and use specific object to draw (QBrush, QRect,... and so on). Indeed, QPainter is the handler of everything that you will paint. If you don't have tools you won't paint anything.
Take it in this way... QPainter is a real Painter, and what can a Painter do without tools and place to paint?
Please show me some advance and I will teach you what you need.
Thanks
-
To be concrete, QPainter won't solve your problems, I know, it's kind of counterintuitive, but what really is important is to handle the QPaintEvent and use specific object to draw (QBrush, QRect,... and so on). Indeed, QPainter is the handler of everything that you will paint. If you don't have tools you won't paint anything.
Take it in this way... QPainter is a real Painter, and what can a Painter do without tools and place to paint?
Please show me some advance and I will teach you what you need.
Thanks
@Charlie_Hdz
OK, thank you for explanation. What is my scenario? A: I want to create a custom QtQuick Item (QQuickPaintedItem
) which will draw a path. I named itPathDrawer
.
There is paint method of my item:void PathDrawer::paint(QPainter *painter) { painter->setRenderHint(QPainter::Antialiasing); QPen pen(m_strokeColor, m_lineWidth); QBrush backBrush(m_fillColor); pen.setCapStyle(Qt::RoundCap); painter->setBrush(backBrush); painter->setPen(pen); if(!m_points.isEmpty()) { painter->drawPolygon(QPolygonF(m_points), m_fillRule); } }
But my problem is that line will draw out of the region and I what make it controllable.
-
Question,
Does it painting already?
Thanks