On 18. juni 2010 14:43, ext Artur Souza (MoRpHeUz) wrote:
> On Fri, Jun 18, 2010 at 6:10 AM, Kent Hansen<[email protected]>  wrote:
>    
>
>> I _think_ you should be able to get the engine by creating a C++ slot
>> that takes a QScriptValue as argument, call that slot from QML, and call
>> QScriptValue::engine() on the argument. If thats works, it effectively
>> means we do already expose the QtScript API in public, but not with the
>> intention to use the full API (e.g., it should be fine to call
>> toNumber() on the QScriptValue, but not, say, installing a custom
>> QScriptEngineAgent on the engine()).
>>      
> I will try this and let you know about the results!
>    


I verified that this does indeed work.


>    
>> Hmm, taking this idea further, did you try subclassing QScriptable? Then
>> you could get at the arguments and thisObject() too. :-)
>>      
> Seems like a good idea too ;)
>    


This doesn't work. QtDeclarative currently doesn't use the same QObject 
method call logic as QtScript. You can "fix" that by uncommenting the 
two lines after "// Uncomment to use QtScript method call logic" in 
qdeclarativeobjectscriptclass.cpp. That will also make overload 
resolution work.

Kent
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to