[Development] Changing qreal to a float

Thiago Macieira thiago.macieira at intel.com
Tue Feb 21 10:31:16 CET 2012

On terça-feira, 21 de fevereiro de 2012 09.59.49, Marc Mutz wrote:
> A tangential question: should QRect be QBasicRect<int> (in which case it
> would  probably have a class invariant of right()-left()==width() instead
> of width()-1 as now. If there is a plan to move to CRect semantics (not
> sure I'd like that), then keeping QRect and using QRectI = QBasicRect<int>
> could do the trick.

QRect must have the same semantics as it has today. Whether we want to add a 
*second* rectangle class with slightly different semantics, I'll leave up to 
the implementor.

I'd rather it were part of the template. That means whoever is implementing 
this template needs to add some magic for the logic for integers to be 
different from the logic from FP.

In time, it's usually a good idea to have a range of [start, end) -- that is, 
inclusive of the start and exclusive of the end. It's a matter of choosing the 
operators right when doing comparisons. But that implies on integer quantities 
that "end" is "the successor of the last valid element". That's an invariant 
that the STL iterators already match.

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/20120221/0780cf20/attachment.sig>

More information about the Development mailing list