Hello,What is the difference between QRect and QRectF? The following code work well. It is interesting.
Printable View
Hello,What is the difference between QRect and QRectF? The following code work well. It is interesting.
Quote:
What is the difference between QRect and QRectF ?
Double values are implicitly converted to integers. You can find detailed info here: Type Conversions
I understand,But if the double value converted to integer,why the QRect and the QRectF were built? please explain,thank you.
Check the link mentioned by stampede, all you need is there.
Exactly the same reason you have integers and doubles, sometimes you want one, sometimes the other :)Quote:
if the double value converted to integer,why the QRect and the QRectF were built?
With Qt 4, the coordinate system used in painting was changed from integer-based (pixels) to floating point (world coordinates). This permitted scaling and other transformations to be specified and performed more precisely, without rounding errors. In order to not break all existing code, a new set of floating point coordinate classes (QRectF, QSizeF, QPointF, etc.) was introduced side-by-side with the integer versions, and painting operations were extended to use the new floating point classes without changing the pre-existing integer methods.Quote:
why the QRect and the QRectF were built? please explain,thank you.