[Interest] scaling QRect inside a QWidget
Nicolas Jäger
jagernicolas at legtux.org
Fri Mar 4 14:02:54 CET 2016
Le Fri, 4 Mar 2016 10:29:11 +0200,
Nye <kshegunov at gmail.com> a écrit :
> Hello Nicolas,
> > just scaling the widget don't resize the QRect
> I don't see a reason this should happen automatically, you're supposed to
> scale your rect yourself.
ok
> > But first, since widths are int, I have to make a conversion to float
> then to int, who brings some rounding errors.
> This is expected, you can't keep precision when truncating from floating
> point to integers. However, the errors are in the range of +-1, so in most
> cases this shouldn't be a problem.
>
> > And for some reason when I pass the value my QRect doesn't get the good
> value (note that, this may comes from our code).
> Possibly an error in your code, try debugging it and tracing the reason for
> that.
that's going to be my task today... I will first use a dummy qrect to see the difference with my
actual qrect then bugging the code with a lot of qdebug to see where I do some change on that
actual rectangle, etc.
> You could use QRectF, which employs floating point coordinates, if that
> suits you better.
that"s may be a solution
thx,
Regards,
Nicolas
More information about the Interest
mailing list