How to pass slot as parameter?

  • I don't understand how to do this like for example:

    @void RequestMessage(SLOT *callback)

    I want someone to be able to specify a function on which they get the callback.

  • SLOT is a "function": It can either member of a class or standalone function.

    If you need to pass a slot to another function then declare that another function with pointer to a slot-function as a parameter and then call that parameter. An example with member function:
    class A
    public slots:
    void foo(int);

    void otherFunction(void (A::*param)(int))

Log in to reply

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