Matt. C. wrote:
> Basically you just use signals and slots to signal the main thread from 
> the worker thread.  Look at Qobject.connect and Qt::QueuedConnection in 
> QtAssistant.

I think this went to me personally, whereas the original poster would 
want it on the list so he could see it. :)

Queued connections are one way. Personally, I've used this:

MainThreadUpdater updater = new MainThreadUpdater(ui.widget);
QCoreApplication.invokeAndWait(updater);

Where MainThreadUpdater implements Runnable and basically just calls the 
user interface widget's update() method.


> On Fri, Oct 2, 2009 at 11:17 AM, Derek Fountain 
> <derekfount...@yahoo.co.uk <mailto:derekfount...@yahoo.co.uk>> wrote:
> 
>      > I'm working on a program that search for bluetooth devices and
>     sends a
>      > file its.
>      > The problem is that when I find out a new device I need to
>     register it
>      > on a QTreeWidget and actually the compiller tell me that it can't
>     do it
>      > because the object "ui" is in another thread...
>      > Anyone know a solutions for this?
> 
>     No, it's a restriction of QtJambi that all GUI things need to run in the
>     main thread. You need to rearrange your code so that the widget is
>     handled in the main thread, and your worker thread tells it to update
>     with the new device information.
>     _______________________________________________
>     Qt-jambi-interest mailing list
>     Qt-jambi-interest@trolltech.com <mailto:Qt-jambi-interest@trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
> 
> 

_______________________________________________
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to