[Development] Changing qreal to a float

Boudewijn Rempt boud at valdyas.org
Mon Feb 20 17:20:58 CET 2012

On Monday 20 February 2012 Feb, Samuel Rødal wrote:
> On 02/20/2012 04:58 PM, ext Christoph Feck wrote:
> > On Monday 20 February 2012 16:02:09 Thiago Macieira wrote:
> >> I also thought we had agreed that QRectF should be float on all
> >> platforms and we don't need double-precision geometric classes
> >> anyway.
> >
> > I think we agreed on the former, but hopefully not on the latter. Many
> > geometric classes, such as QLineF, have functions that are used
> > outside rendering, so having double-precision classes are very useful
> > to have.
> >
> > Maybe add explicit QRectS and QRectD classes, and deprecate QRectF
> > (same for QPointF, QLineF and friends)?
> This seems quite unfeasible. These classes are mainly used together with 
> QPainter (or scene graph for QML 2), 

Er, I don't think you can put it that way. Those classes were public api in Qt and are used for all kinds of purposes in all kinds of applications. Frankly, this discussion has me dreading the Qt4->Qt5 move... Not just my pet application, Krita, will be affected (1), but customer's applications as well. And those don't ship with a custom-built Qt either. 

> and if those are to use float 
> internally, I don't really see the point with keeping double versions 
> around for just a subset of classes.

Well, Qt is a library, a platform -- and that means that you cannot predict how and when classes and things like qreal will be used, and that if something is changed there, it _will_ mean a porting effort, potentially a big one. Heck, we haven't even really recovered from the previous porting from Qt3 to Qt4!

And anything you change can have huge consequences: I know of one application that was hit by optimizations in QPainter between Qt 4.5 and Qt 4.6 where a huge part of the core engine had to be rewritten.

1) 8389 instances of qreal, 2845 of QRectF, 6601 of QPointF, 253 of QLineF. 
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl

More information about the Development mailing list