QScriptEngine using newFunction() on non-static functions.



  • Hello,

    As the title says, I am wondering if it's possible to use the newFunction() method and wrap a non-static member function of a class I have.

    For example...right now I am able to wrap a static C++ function by doing something like this:
    @QScriptValue ProcessStart = myScriptEngine->newFunction( &ScriptEngineCommandList::ProcessStart );@

    but I when I try to do the same by using a function reference in a class instance like this:
    @QScriptValue ProcessStart = myScriptEngine->newFunction( &myInstance->ProcessStart );@

    I get the error "Illegal operation on bound member function expression".

    I wonder if it is possible to do this with non-static member functions of a class instance or maybe I am referencing the adress in a wrong way...

    Thanks in advance any comment is very welcome.



  • I'm afraid it's not possible.

    I'm adding scripting into my app using prototypes to wrap objects. Take a took to it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.