PDA

View Full Version : Designing Multithreaded app in Qt



summer_of_69
18th June 2009, 14:09
I want to create multi-threaded application in Qt (GUI).

Thread 1: Take account of all the logging.
Thread 2: Some math calculations(worker thread).
Thread 3: GUI

What is the best architecture I should go for :confused:? I will higly appreciate any pointer or code snippete

Thanks in advance.

wagmare
18th June 2009, 14:59
u cant do GUI in QThreads .. QWidget is not reentrant ... so thread3 is invalid ..

use the gui as main event loop .. from there spawn two thread
thread1: loggings (only text, image, QTimers .,..)
thread2: calculation algorithms ..

best example if u are newbie to QThread is
/examples/network/blockingfortuneclient
because for me it looks very easy to ride the concept ..

summer_of_69
18th June 2009, 15:04
Thank you very much for your reply and pointer :)

wysota
18th June 2009, 16:46
You can do 1. and 3. in the same thread. For 2. you can (but don't have to) use an external thread.

Read the article in QQ: http://doc.trolltech.com/qq/qq27-responsive-guis.html