I have a tablewidget which needs to be appen开发者_Go百科ded with data from a child thread.
I get this error It is not safe to use pixmaps outside the GUI thread. In c# I used a Disptacher to tell the mainThread to append data in a gui object.
I assume there is some how something close to this? Am using qt4.7 I have made a slot in the parent and a signal within the thread object.. an emit signal from the child thread to send a signal to a slot in the parent. but the signal is not firing. when i execute the method like so object->run(); (i.e from mainthread) it works fine.. but when i execute it from the thread object->start(); the signal is not fired.. i neeed to do somework with a thread not in mainthread..
UPDATE--27/09 i just got to the root of the problem.. the signal and slot are working but the child thread is lauching a qnetworkaccessmanger object that is causing all this trouble.. i commented the networkaccess object and no error.. I need the thread to call a network request.. and update the results in the gui..
The easiest way is to use Qt's signal/slot mechanism with a connection type of Qt::QueuedConnection. This queues the call to the slot in the thread the receiver object lives in automatically.
精彩评论