[Qt-interest] QT3's postEvent VS QT4's connect (blocking queued connection)
Andreas Pakulat
apaku at gmx.de
Sun Jan 11 16:10:04 CET 2009
On 10.01.09 21:13:27, Neeraj Jhawar wrote:
> >
> > Then why are you using a separate thread at all? If your GUI is supposed to
> > block while you fetch the data just do the data-fetching inside the GUI
> > thread. That'll remove all needs for cross-thread-communication.
> >
> > Andreas
> >
> >
> This is because when I try to update the GUI at this rate, all the buttons
> hang. I just cant get them working smoothly enough. I am fetching the data
> at 100 ms period ( or 1/100 ms freq). at this rate when I try to update GUI
> , the buttons like "STOP OPERATION" and "EXIT" and "SAVE TO FILE" are numb
> and I just cant help them.
>
> Is there a way I could just do this without threads... i.e. take the updates
> from a GUI function and the buttons are still smooth enough??
Yes, you need to give the eventloop time to run. So instead of using
threads to do your updates try to use QTimer and let your slot doing the
updates be triggered every 100ms.
As with the threading method this might not guarantee you 100ms update
cycles, but it'll guarantee you that all updates to your gui are done
and the gui is still responsive.
If you absolutely need to make 100ms cycles for gui updates then you most
probably need to drop Qt and do it with the platform specific GUI API
(win32, carbon/cocoa or X11).
Andreas
--
Your object is to save the world, while still leading a pleasant life.
More information about the Qt-interest-old
mailing list