[Qt-interest] Using Qpainter/Qgraphics for a gps car-like

Dave Smith dave at thesmithfam.org
Thu Mar 4 18:46:04 CET 2010


Gustavo B. Schenkel wrote:

> this points exist, and form a rectangle. If i use the QpainterPath how i can 
> insert this points? Since the start position in qpainterpath is 0,0 and this 
> points are -29,-53? 

Try using the moveTo() method like this:

   QPainterPath path;
   path.moveTo(point1); // -29 | 53
   path.lineTo(point2); // now draw the 4 lines of the rectangle
   path.lineTo(point3);
   path.lineTo(point4);
   path.lineTo(point1);
   painter.drawPath(path);

Even better would be to just use QPainter::drawRect() perhaps?

Good luck!

--Dave



More information about the Qt-interest-old mailing list