Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Overwrite functions(methods) on script side
Forum Updated to NodeBB v4.3 + New Features

Overwrite functions(methods) on script side

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k Views 1 Watching
  • 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 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved