Overwrite functions(methods) on script side



  • Hi everyone. I'm playing with QScript module and I'm following this "tutorial":http://doc.qt.nokia.com/4.7-snapshot/scripting.html .
    Everything is nice, but I couldn't find a way to ovewrite a function(method) on the script side.
    Let me show you what I wanna do, so you can make an ideea:
    On C++ side let's say I have a class that implements QRunnable

    @ class HelloWorldTask : public QRunnable
    {
    void run()
    {

     }
    

    } @

    Now I want to do something create many HelloWorldTask objects on script side, and overwrite the run method. something like this:

    @var task=new HelloWorldTask();
    task.run=function(){
    print("Hello world");
    }@

    Is it possible? if not what would be the best way to achieve this?


Log in to reply
 

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