Reputation: 33
I call singleshot in a button press callback, but my timeout slot never gets called, in the debugger my code gets to where i call the singleshot function, but it never gets to the breakpoint in my timeout function.
In the .h:
private slots:
void on_snoozeTimeout(Data d);
In the .cpp:
void MyClass::on_snoozeBtn_clicked()
{
QTimer::singleShot(snoozeTimeoutValue*1000,this,SLOT(on_snoozeTimeout(selectedData)));
}
void MyClass::on_snoozeTimeout(Data d)
{
//not hitting this breakpoint
}
Upvotes: 0
Views: 1998
Reputation: 8277
The SLOT
macro can't accept function parameters the way you are trying to use it. Use a lambda instead:
QTimer::singleShot(snoozeTimeoutValue*1000, [this, selectedData](){
on_snoozeTimeout(selectedData);
});
Upvotes: 1