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. QScriptEngine using newFunction() on non-static functions.
Forum Updated to NodeBB v4.3 + New Features

QScriptEngine using newFunction() on non-static functions.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k 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.
  • Q Offline
    Q Offline
    Qnoobish
    wrote on last edited by
    #1

    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.

    In short, software is eating the world.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ilean
      wrote on last edited by
      #2

      I'm afraid it's not possible.

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

      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