Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. [solved]callback in Qt class

[solved]callback in Qt class

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 2 Posters 4.4k 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.
  • D Offline
    D Offline
    dridk
    wrote on last edited by
    #1

    Hello, I have a simple question !
    I m using Box2D library in my Qt application.
    I need to use this function : void Query (b2QueryCallback *callback, const b2AABB &aabb)
    How can I create a callback in my my C++ class ?

    @

    void MyClass::test()
    {

    }

    void MyClass::explosition()
    {

    mWorld->query(test, aabb);

    }

    @

    I m sure it's pretty easy.. But I never used callback function in C++ ...

    EDIT: moved to C++ Gurus, as this is not Qt related..., Gerolf

    Nothing in Biology Makes Sense Except in the Light of Evolution

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      Hi dridk,

      I don't know Box2D, but there are only 2 possibilities:

      b2QueryCallback is a function definition, then you must use a function (not a member) as callback.

      b2QueryCallback is a C++ interface, then you class must derive from this interface and implement it.

      I googled for this name and found, "it's a class":http://programanddesign.com/box2d/classb2QueryCallback.html so just derive your C++ class from that class and implement the needed methods.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dridk
        wrote on last edited by
        #3

        Ok, It was so simple! Thanks

        Nothing in Biology Makes Sense Except in the Light of Evolution

        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