[Qt-interest] Basic update() paint event question
Phil
phillor at telstra.com
Mon Jan 26 05:54:39 CET 2009
On Friday 23 January 2009 11:05:23 andrew.m.goth at l-3com.com wrote:
> Phil wrote:
> > Calling update() under QT3 used to work and reading the
> > documentation hasn't helped. How do I now force a paintevent
> > under QT4?
>
> http://doc.trolltech.com/4.4/qwidget.html#update
>
> "This function does not cause an immediate repaint; instead it schedules
> a paint event for processing when Qt returns to the main event loop."
>
> Are you returning to the Qt main event loop between calls to update()?
Yes.
> If you're calling update() inside a loop, the updates won't actually
> happen until the loop ends.
>
> You could try using repaint(), but you should be able to use update().
Repaint() and update() are both ignored.
> Let's figure out why it's not working for you.
That would be great Andrew, and thank you for your reply too Chandru.
After thinking about the problem for the past four days, I think update()
might be failing because of the widget that I'm trying to repaint.
I have a Designer generated main window that includes a frame. I have promoted
that frame to a class that I have called Map. The Map class has a paint event
that works correctly if the window is resized or is uncovered, so I don't have
a problem there.
The base class (which is a sub class of the main window) calls the Map class
when a repaint is needed but update() is ignored. If, as I said in my earlier
plea for help, I set up a timer signal / slot connection within Map then
update() works as it should. I don't want the Map class to control when a
repaint takes place, the base class should control repainting.
So, does this extra information show where I've made an error?
I thought about using the base class to start a very short time out period for
a timer signal / slot connection in the Map class but that seems to be a
roundabout way of making things more complicated that they should be.
--
Regards,
Phil.
More information about the Qt-interest-old
mailing list