Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Issue with QPolygonF and QGraphicsPolygonItem (brought a picture)
Pippin last edited by Pippin
I seem to be having this unwanted black segment when drawing triangles. Here's what I did with the QPolygonF:
qreal root = qSqrt(3)/2; QPolygonF DownwardTriangle = QPolygonF(3); DownwardTriangle << QPointF(root, .5)*80 << QPointF(-root, .5)*80 << QPointF(0, -1)*80 << QPointF(root, .5)*80;
and here's how I added it to the QGraphicsScene:
auto foo = WindowScene.addPolygon(DownwardTriangle, QPen(), GrayBrush); foo->setPos(100, 100);
I tried both fillRules but I got the black segment (from the top-right corner to the center of the triangle) in both cases regardless. I can't get rid of it. The top-right corner matches the first and last QPointF that I stored inside
Any help would be appreciated. Thank you.
Devopia53 last edited by
U have a garbage points.
QPolygonF DownwardTriangle = QPolygonF(3);
<-- U must delete "QPolygonF(3)"
Pippin last edited by
Thank you! The problem disappears if I drop the