Hello again everybody.
Suppose i have a mainwindow with some widgets on it .
Now i want to create a separate thead and, in it's run() , to access the widgets from the mainwindow .
How can this be done ?
Hello again everybody.
Suppose i have a mainwindow with some widgets on it .
Now i want to create a separate thead and, in it's run() , to access the widgets from the mainwindow .
How can this be done ?
In one of the recent posts i have read that you cannot access widgets from a separate non-gui thread.
I'm a rebel in the S.D.G.
You could do some interaction between the GUI and a non-GUI thread by using signals/slots. One separated thread could emit a signal changeLabelText(const QString&) thats connected to a QLabel::setText(const QString&) from the GUI-thread, the result is that the label setText call would be enqueued at the GUI thread event queue (it will only be effectively called on the Qt event handling thread, the GUI one).
Controlling widgets from outside the GUI thread is totally possible with some workarounds (I've implemented a win32 multithreaded GUI library port to linux and mac through Qt).
Take a look at
http://doc.trolltech.com/4.4/threads...s-and-qobjects
for further info.
Bookmarks