JustinBlaber
JustinBlaber

Reputation: 4650

Setting values in QPolygonF

I'm trying to set a value in a QPolygonF object to a certain value. For example:

QPolygonF *polygonPoints;
polygonPoints->resize(2);
polygonPoints[1] = QPointF(5.0,5.0);

When I try to compile I get an error which says there is no operator found which takes a right-hand operand of type 'QPointF'. QPolygon is inherited from QVector so I feel this should work... The above code works when I use "<<" but I'd like to modify specific values in the polygon instead of just appending values. Thanks.

Upvotes: 2

Views: 2057

Answers (1)

alexisdm
alexisdm

Reputation: 29886

QPolygonF (and all the other Qt containers) are best used without pointers or else you'll need to dereference the pointer:

(*polygonPoints)[1] = QPointF(5.0,5.0);

Upvotes: 2

Related Questions