Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Overwrite functions(methods) on script side

    General and Desktop
    1
    1
    1218
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 2
      2beers last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post