[Qt-interest] drawing polyline with QPainterPath
Jan
janusius at gmx.net
Tue Jun 2 09:56:43 CEST 2009
Hi,
I have subclassed QGraphicsPathItem to draw a polyline in my
graphicsview. This is the code:
QPainterPath path;
path.addPolygon(m_line); //m_line is a non closed polygon
path.connectPath(path.toReversed());
setPath(path);
in paint() function:
painter->drawPolyline(m_line);
The problem is, that it is always treated as an area i.e. last and first
point are connected which is visible when I hover the area with the
cursor. My "workaround" was this :
path.connectPath(path.toReversed());
I add the same polyline in a reversed order and don't use
painter->drawPath(path()) in the paint function.
How can I draw a polyline with QPainterPath that is not connected
(first, last point) and therefore has no area without this "reversed" thing?
Bye
Jan
More information about the Qt-interest-old
mailing list