[Qt-interest] (no subject)

Malyushytsky, Alex alex at wai.com
Sat Jan 10 05:28:40 CET 2009


I don't have link to QT3 documentation, other than
http://www.mathematik.uni-ulm.de/help/qt-2.3.1/threads.html

But if You have QT 3 installed you should have documentation.

Search for "Thread Support in Qt" there.


In short, use
  QApplication::postEvent  to send events safely. (don't use sentEvent)

>From documentation:

Thread-safe Event Posting
In Qt, one thread is always the GUI or event thread. This is the thread that creates a QApplication object and calls QApplication::exec(). This is also the initial thread that calls main() at program start. This thread is the only thread that is allowed to perform GUI operations, including generating and receiving events from the window system. Qt does not support creating QApplication and running the event loop (with QApplication::exec()) in a secondary thread. You must create the QApplication object and call QApplication::exec() from the main() function in your program.
Threads that wish to display data in a widget cannot modify the widget directly, so they must post an event to the widget using QApplication::postEvent(). The event will be delivered later on by the GUI thread.
Normally, the programmer would like to include some information in the event sent to the widget. See the documentation for QCustomEvent for more information on user-defined events.


I would recommend QT4 if the code is new or small.
Depending on the complexety of your code, porting might be very time consuming task,.
In some cases it would be faster to write application from the scratch..

Also try to create thread with subject - this way you can get more help.

Best regards,
Alex


________________________________
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Neeraj Jhawar
Sent: Friday, January 09, 2009 6:38 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] (no subject)

Hello Everyone

I am using QT3 and wish to do some cross thread communication between two threads in QT. I learnt that this can only be done using event in QT3.

Could someone please throw some light on how to get it done.

Also if possible, any supplement link or material would be of great help.

Thx

Sincerely,
On Sat, Jan 10, 2009 at 10:09 AM, Neeraj Jhawar <navderm at gmail.com<mailto:navderm at gmail.com>> wrote:
Respected Sir,

Could you give me some reference as to how I communicate using events between the threads.
Any material or some link.

Thanks a lot.

On Sat, Jan 10, 2009 at 8:22 AM, Andreas Pakulat <apaku at gmx.de<mailto:apaku at gmx.de>> wrote:
On 10.01.09 04:39:39, Neeraj Jhawar wrote:
> Is there any way this problem of cross thread signal slot model can be done
> in QT3?
No, Qt3 doesn't support cross-thread signals/slots. You have to use event's
in Qt3 to communicate between Threads.

> Am really apprehensive of using QT4 after everything has been done...
I suggest you really consider switching to Qt4 (not instantly, but starting
to do so), Qt3 is not maintained anymore. Qt Software doesn't support it
anymore since quite some time already.

Andreas

--
You will experience a strong urge to do good; but it will pass.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com<mailto:Qt-interest at trolltech.com>
http://lists.trolltech.com/mailman/listinfo/qt-interest


--
Neeraj Jhawar
Senior Undergraduate
Mechanical Engineering Department
Punjab Engineering College
Chandigarh.
India



--
Neeraj Jhawar
Senior Undergraduate
Mechanical Engineering Department
Punjab Engineering College
Chandigarh.
India


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090109/5170eeea/attachment.html 


More information about the Qt-interest-old mailing list