mercredi 20 juillet 2016

Create an open polygon in Qt (line strips)

How can I create an open polygon, with using a QVector to initialise the polygon, in Qt?

QPolygonF will always close the Polygon and connect the last point with the first one.

Thank you for help

[Edit]

In QGraphicsScene

QVector<QPointF> test{{1,1},{100,1},{100,100}};
QPolygonF polygon(test);
addPolygon(polygon);
qDebug() << polygon.isClosed();
qDebug() << polygon.first() << polygon.last();

Output:

  • a triangle, but I don't want a triangle. I want a line strip
  • polygon.isClosed() = false
  • First = 1,1
  • Last = 100,100

Aucun commentaire:

Enregistrer un commentaire