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

Andre Somers andre at familiesomers.nl
Mon Mar 15 16:51:25 CET 2010


Gustavo B. Schenkel wrote:
> The problem is the points, they have too much numbers after the 
> dot, in the screen they show all in the same place.
>
> Then i don't know if i need do some calculation to transform this 
> numbers to others.
>
> i am sending my painter code. I am using the setWindow function 
> but i still don't know much about it.
>
> void RenderArea::paintEvent(QPaintEvent * /* event */)
> {
>
>     static const QPointF square[4] = {
>             QPointF(-29.683436, -53.800570),
>             QPointF(-29.683795, -53.799620),
>             QPointF(-29.684242, -53.800749),
>             QPointF(-29.684478, -53.799623)
>         };
>
>
>     QPainter painter(this);
>     painter.setRenderHint(QPainter::Antialiasing, true);
>     painter.setWindow(-33,-57, 10, 10);
>     painter.save();
>     painter.drawPolygon(square, 4);
>     painter.restore();
> }
>
>   
Just an extra idea:
Because implementing drawing a map is tricky, perhaps it would be better 
to look into re-using what's already there. For instance, you can 
integrate Google Maps into your application, and draw your own stuff on 
top using it's API or the file format they support for that. Or, you 
look into Marble, which is already based on Qt.

André






More information about the Qt-interest-old mailing list