derek_r
29th September 2007, 17:48
Greetings,
I've been playing around with the newer QtScript functionality from Qt 4.3, and right now I'm trying to figure out the best way to allow me to modify a QByteArray in a script function.
Preferrably it would be something treated as a normal script Array (so you can use the [] to access elements).
By subclassing QByteArray and adding Q_OBJECT, I've been able to get a class that I can use QScriptEngine::newQObject() with, and pass as a QScriptValue into the script function (to which I can access the methods designated as 'slots').
From some testing it would appear that I cannot make 'operator[]' a slot (compiler gives an error 'Not a signal or slot declaration'); so my question is, is there a way to achieve a normal array functionality through a passed-in QByteArray (or some derivative thereof)?
Any ideas/insight would be appreciated!
Thanks,
Derek R.
I've been playing around with the newer QtScript functionality from Qt 4.3, and right now I'm trying to figure out the best way to allow me to modify a QByteArray in a script function.
Preferrably it would be something treated as a normal script Array (so you can use the [] to access elements).
By subclassing QByteArray and adding Q_OBJECT, I've been able to get a class that I can use QScriptEngine::newQObject() with, and pass as a QScriptValue into the script function (to which I can access the methods designated as 'slots').
From some testing it would appear that I cannot make 'operator[]' a slot (compiler gives an error 'Not a signal or slot declaration'); so my question is, is there a way to achieve a normal array functionality through a passed-in QByteArray (or some derivative thereof)?
Any ideas/insight would be appreciated!
Thanks,
Derek R.