> If you have a signal in your model:
> 
>   QSignal0 modelChanged
> 
> and you connect
> 
>   modelChanged.connect(view, "update()");
> 
> then when you do:
> 
>   // update model in model thread
>   modelChanged.emit();
> 
> update() will be called on the view in the GUI thread. This is a queued 
> connection. Actually it is an auto connection which decides to do the 
> operation queued at run time because the emitter and receiver are in 
> different threads.
> 
> The connect statement can be performed from any thread.

OK, I think I understand this now. :) But it's still not working. 
Firstly, is there a QSignal0 class? I've used QSignalEmitter.Signal0. Is 
that what you meant, or have I missed something else? :)

More importantly, I've used something similar to the code above, and 
still get an exception. Inside my view class, which extends QWidget, 
I've created a field called updateSignal which is a Signal0. From inside 
my view class constructor I make the queued connection explicitly like this:

  this.updateSignal.connect(this, "update()",
                            Qt.ConnectionType.QueuedConnection);

and from the thread started by the model's Timer, I do the emit like this:

  this.updateSignal.emit();

When I do the emit, I get a QThreadAffinityException with a message of 
"QObject used from outside its own thread". The exception message says 
the view object is the offender. I guess I can only get the view to do 
the emit from within the main thread?

I've yet to try the other methods. Do you have any further advice on how 
I can fix this one first?
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to