[Development] Changing qreal to a float

Thiago Macieira thiago.macieira at intel.com
Mon Feb 20 20:16:18 CET 2012

On segunda-feira, 20 de fevereiro de 2012 18.36.50, Marc Mutz wrote:
> Please look at the numbers that Boudewijn posted in the footnote (in the
> mail  that you replied to) and realise that you need to keep qreal/QFooF in
> deprecated peace. I, too, know of too much customer code that'd break
> otherwise.
> I actually love Christoph's QRect{D,S} idea. Just template the
> implementation  (and make QRectX a typedef, don't inherit!!) on the FP type
> and you can even throw in QRectL into the mix.

Maybe this then:

#  if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
typedef float qreal_t;
#  else
typedef double qreal_t;
#  endif
Q_DECL_DEPRECATED qreal_t qreal;

template<typename T> class QBasicRect

typedef QBasicRect<float> QRectS;
typedef QBasicRect<double> QRectD;

class QRect : public QRect<int>
    /* constructors */

Q_DECL_DEPRECATED class QRectF : public QRect<qreal_t>
    /* constructors */

I personally don't like the name QBasicRect but QRect is taken already. 
QRectangle would help here, but not for QPoint or QSize. Also, the S and D 
suffixes are weird.

PS: bonus points for whoever guesses why I introduced qreal_t.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120220/beb4e7ef/attachment.sig>

More information about the Development mailing list