QGraphicsPolygonItem drawing an open (not closed) polygon

I am using QGraphicsPolygonItem and I noticed that it always connects the endpoint to the starting point.

I know that the terms of a polygon mean exactly that, and what I'm looking for is a "polyline" or "polygonal chain." I did not find anything like this in subclasses of QGraphicsItem.

How to draw a polygon chain in the QGraphics Framework? Is there a QGraphicsPolygonItem property or a class that does this?

+5
source share
2 answers

QPainterPath lineTo yors, QGraphicsPathItem, .

QGraphicsLineItem QGraphicsItemGroup, , .

, ?

EDIT:

QPainterPath - , -, , .

EDIT2:

, , HostileFork - QPainterPath pathItem->setBrush(QBrush(Qt::transparent));, .

+3

, QGraphicsPathItem. QPolygonF (.. QPolygonF, ):

QPainterPath path = new QPainterPath();
path.addPolygon(polygon);
QGraphicsPathItem contour = new QGraphicsPathItem(path);
contour.setPen(new QPen(QColor.black));

QGraphicsPathItem () .

, Java; , ++.

+3

All Articles