[Qt-qml] Getting access to QML objects from a workerscript
Sivan Greenberg
sivan at omniqueue.com
Mon Oct 10 19:16:03 CEST 2011
Hi Ronan!
On Mon, Oct 10, 2011 at 5:50 PM, <ronan.maclaverty at nokia.com> wrote:
> Player.myplayer = player
> workThread.sendMessage( {} );
>
> The WorkScript.onMessage function cannot access player.
>
> I am sure that I have missed some crucial piece of documentation somewhere, but any help solving this issue would help.
>
In http://doc.qt.nokia.com/4.7-snapshot/qml-workerscript.html#sendMessage-method
, it is said:
"The message object may only contain values of the following types:
boolean, number, string
JavaScript objects and arrays
ListModel objects (any other type of QObject* is not allowed)
All objects and arrays are copied to the message. With the exception
of ListModel objects, any modifications by the other thread to an
object passed in message will not be reflected in the original
object."
Could this be causing your problems? I have no experience myself with
WorkerScript, however I know from other similar systems there is quite
some constraints on the "messages" you can pass as objects to other
context to be run in parallel...
If this is not the issue, I will be also quite curious to know how to
do something like this, how to pass the instances properly for
processing, consider Python's Queue.Queue module and multiprocessing.
-Sivan
More information about the Qt-qml
mailing list