[Qt-interest] Can Update() be called other than GUI thread

John McClurkin jwm at nei.nih.gov
Tue Jan 19 19:42:27 CET 2010


trinathpujari wrote:
> Hi All,
> 
> I have multi threaded application which uses QT.
> 
> Is it possible to call Update() of QT other than GUI thread i.e 
> QApplication thread   ?
> 
> If i am trying to call Update() from Thread T1 which is not under App 
> thread, it is not invoking the Paint function i.e Paint(QPainter* 
> painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
> 
> For few times Paint function gets called by calling Update() from some 
> other thread also i.e T1.
> 
> Does QT Supports multi threaded application ?
> 
> Please help us in this regard...
> 
> Thanks
> Naresh
> 
> 
> 
Qt does support multi threaded applications, but all drawing must be 
done in the thread that calls main(); If you want to update drawing from 
a non-gui thread, use the signal-slot mechanism. That is, have the 
non-gui thread send a signal to a slot in the gui thread that calls 
update on your widget. See the "Thread Support in Qt" section of the 
documentation.



More information about the Qt-interest-old mailing list