[Qt-interest] float/double-precision using QGraphicsView

Tobias Nothdurft t.nothdurft at tu-bs.de
Fri Jul 31 16:41:01 CEST 2009


Hello everybody,

i'm using QT 4.4.3, XFCE and Debian Linux (stable).

I have to draw stuff on top of georeferenced aerial images. So the  
coordinates I have to use are about:

x = 4402490
y = 5791850

As you can imagine, float-precision simply isn't enough to draw nice  
things using world coordinate coordinates like UTM (or Gauss Krueger  
in my case).

So when i want to paint like this:

     QPen pen = QPen();
     pen.setStyle(Qt::DashLine);
     pen.setColor(Qt::blue);
     painter->setPen( pen );
     painter->drawRect(m_boundingRect);

     QBrush brush = QBrush();
     brush.setColor(Qt::yellow);
     brush.setStyle(Qt::SolidPattern);
     painter->setPen( QPen() );
     painter->setBrush( brush );
     painter->drawRect( m_boundingRect );

.. this is what happens:

http://www-public.tu-bs.de:8080/~tobnot/precision.png

When I draw objects without a brush and with style Qt::DashLine QT  
seems internally to use double precision. Otherwise not.

Is there a way, that QT uses double-precision everytime??

Have a nice weekend.

Tobi





More information about the Qt-interest-old mailing list