Hi Nye and others,

I use the resize event, the problem is how can I scale properly the QRect, 
because just scaling the
widget don't resize the QRect. I try to compute the ratio = newWidth/oldWidth 
of widget then doing
newWidthOfQRect * ratio. But first, since widths are int, I have to make a 
conversion to float then
to int, who brings some rounding errors.

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). But I try to figure if there is another way than 
computing width, height, new
position of the QRect.

Regards,
Nicolas



> You could intercept the QWidget's resize event either by providing an
> override (http://doc.qt.io/qt-5/qwidget.html#resizeEvent) or by installing
> an event filter (http://doc.qt.io/qt-5/eventsandfilters.html#event-filters).
> Note, however, you'll receive a resize event on initialization of the
> widget as well.
> 
> Kind regards.
> 
> On Fri, Mar 4, 2016 at 2:11 AM, Nicolas Jäger <jagernico...@legtux.org>
> wrote:
> 
> > Hi,
> >
> > I have a QRect inside a QWidget and I would like to scale it when the
> > widget is scaled by the user.
> > There is a QtThing to do that ?
> >
> > regards,
> > Nicolas
> > _______________________________________________
> > Interest mailing list
> > Interest@qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> >  

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to