You can provide get/set methods for the class.
You can provide get/set methods for the class.
Sorry I should have given a bit more detail, I currently have get/set methods to allow me to get/set elements in the QByteArray however I was trying to find a way to provide 'operator[]' functionality in the script.
Currently I have this:
Qt Code:
function test(arg) { print("arg[0] = " + arg.getAt(0) + "\n"); arg.setAt(0,123); }To copy to clipboard, switch view to plain text mode
What I'm trying to achieve is this:
Qt Code:
function test(arg) { print("arg[0] = " + arg[0] + "\n"); arg[0] = 123; }To copy to clipboard, switch view to plain text mode
Is the latter possible with QtScript?
Derek R.
I still haven't been able to find a solution to the operator[] question so I've just been doing tests using my set/get methods for array access.
The problem I'm running into now is the speed of accessing the array, just a relatively small array size of 100000 entries takes ~3s to iterate through and set.
I was expecting maybe a few orders of magnitude difference in speed (versus normal C++ execution), however this is more like several orders of magnitude difference. Is there any way to speed this up, or a different way to pass in and modify a byte array in a script function?
Derek R.
Bookmarks