[Qt-interest] QT3's postEvent VS QT4's connect (blocking queued connection)

Arnold Krille arnold at arnoldarts.de
Sat Jan 10 10:51:32 CET 2009


On Saturday 10 January 2009 05:44:42 Neeraj Jhawar wrote:
> The problem that I wish to solve is that QT system ( the new thread) takes
> regular inputs (at 100 ms interval) from RTLinux and shows it in the GUI. I
> have been able to design the connection between QT and RT in the thread but
> the problem comes when i try to show it in QT GUI. I need to show it every
> 100 or so ms and not more. But the postEvent application says it waits till
> the event is called and " The event will be delivered later on by the GUI
> thread." I dont want this. I need a constant connection between the threads
> SIGNAL and the SLOT which will be responsible to show the details in GUI. I
> had read this is possible by connect if you give is blocking queued
> connection.
> So I have started with installation of QT4 (though seriously I dont prefer
> doing it at this stage of my project).
> If such a thing (as desired by me) is possible in with postEvent ... please
> apprise me of the same.

Why do you even consider using separate threads when all you really want is 
synchronous gui updates? You can't get the gui to update synchronously from a 
different thread. Which is not a problem of Qt3 or Qt4 but of the underlying 
graphical system.
Also if you want your gui to update exactly every 100ms, you will need real-
time rights to be exact enough. And it still might not be possible because of 
X...

But: If you just send the new data that is to be displayed to the gui-thread 
(you should really switch to Qt4 because it allows signals across threads) and 
then schedule a gui update by calling update() on the widget that received 
your data, it will update as soon as it can which is probably soon enough. If 
it fails to be soon enough that probably because the graphics-system can't 
update fast enough (and that is a problem that you can't solve in your app).

BTW: Qt3's postEvent works similar to Qt4's version, the event system hasn't 
changed that much from the api-users-pov.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090110/957cffb0/attachment.bin 


More information about the Qt-interest-old mailing list