Inserting Item to a QTreeWidget from Thread?
Hi All,
I m using Qt 4.1.5 on my MAC.
I have a QTreeWidget in which I want to Insert Item at run time from the Thread.I m calling the function in which I have Insert the Item in the Other Class.
Actually It is calling the function but could not Insert the Item in the QTreeWidget.
If anybody knows the Issue then plz help me.
Thanks.
Re: Inserting Item to a QTreeWidget from Thread?
You can't call GUI-methods from another thread but the main thread !
If you want to do so, just emit a signal from your secondary thread, and connect it to an "addItem" slot in your TreeWidget class.
Guilugi.
Re: Inserting Item to a QTreeWidget from Thread?
Quote:
Originally Posted by
guilugi
You can't call GUI-methods from another thread but the main thread !
Generally you can call GUI thread methods from worker threads, but extra care must be taken.
You can't do things that affect in any way the event loop of the main thread. Like drawing on a widget whose paint event is in progress, etc.
Regards
Re: Inserting Item to a QTreeWidget from Thread?
Yup marcel, thanks for clarifying this :)
That's what I meant !