Search code examples
c++qtsignals-slots

Qt- How to use connect between incompatible signal and slot


I am trying to do a game. In this I want to call a function, that function will receive a point . But this function should be invoked by a timer's timedout signal. Can anybody say how to achieve this. Below is the required/error code

Point p(a,b);

connect(timer,SIGNAL(timedout()),this,startDestruction(p));

Can anybody say how to achieve this?


Solution

  • Create a method to use as an intermediate slot, like this.

    Point p(a,b);
    connect(timer, SIGNAL(timedout()), this, q);
    
    q() {
        startDestruction(this->p)
    }