[Qt-qml] Getting access to QML objects from a workerscript
ronan.maclaverty at nokia.com
ronan.maclaverty at nokia.com
Mon Oct 10 17:50:48 CEST 2011
Hi all,
I am trying to get access to some global objects from a QML WorkerScript, and whatever I do I cannot seem to access them. The key object is a C++ object that implements a time consuming function, so I thought this might be the way to go.
The first attempt was to pass the object as inside the workscript message:
MyQml.qml:
Player {
id: player
}
WorkerScript {
id: workerThread
source: "qrc:player.js"
}
workThread.sendMessage( { object: player } );
This did not work - the message.object is not an object.
The second attempt, declare global variables inside the JavaScript file:
player.js:
var myplayer;
MyQml:
import "player.js" as Player
....
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.
Ronan.
More information about the Qt-qml
mailing list