[Interest] Unnecessary repaints.

Jason H jhihn at gmx.com
Thu Dec 17 18:04:42 CET 2015



> Sent: Thursday, December 17, 2015 at 11:45 AM
> From: "william.crocker at analog.com" <william.crocker at analog.com>
> To: No recipient address
> Cc: "interest at qt-project.org" <interest at qt-project.org>
> Subject: Re: [Interest] Unnecessary repaints.
>
> On 12/17/2015 11:16 AM, Jason H wrote:
> >
> >>
> >> My very first Qt app is large and a little sloppy in
> >> that the QWidget::update() function is being called
> >> *someplace* where it should not, This is causing
> >> unnecessary repaints.
> >>
> >> Is there one place I can put a break to find the calls
> >> which actually cause a repaint (and not the calls
> >> which are made when a repaint is already pending).
> >>
> >> Or, can you recommend a better way to diagnose
> >> this problem. (The whole thing needs to be rewritten
> >> now that I am older and wiser, but not just yet.)
> >
> > Why do you think they are unnecessary?
> > Which update() is being called? There's like 4 overloads. Also, realize that Qt will optimize out unneeded updates, or combine multiple into one. I find that Qt is very good about not doing more than needed. It's better to track the paintEvent()s.
> >
> 
> I do not think there is a Qt issue here.
> I'm sure it is me that is calling update when I should not.
> 
> I know they are unnecessary because my app responds with multiple
> screen refreshes (paints) from a single user action. And for me those
> paints can be expensive.


Did you write a widget that calls update()? I'm not sure I understand your concern. update() should only be called when a redraw is needed. This is primarily done to reflect new data, or occasionally because something obscured the widget, which was not stored on a double buffer, and it needs to be redrawn. See also invalidate().

What single user action is happening?




More information about the Interest mailing list