Solved Arguments in connect with lambda expression
-
Hello!!
I am trying to stop a thread after a while with a QTimer::timeout(). This is my function:
void Class::myFunction { QTimer *timer = new QTimer(); MyThread *myThread = new MyThread(); myThread->start(); timer->start(30000); connect(timer, &QTimer::timeout(), [myThread]() {myThread->stop();} ); }
Is there any possibility to do it in that connect?
Thank you very much!!
-
@ivanicy said in Arguments in connect with lambda expression:
&QTimer::timeout()
This is wrong, you want the pointer to a function, not the pointer of the result of a function
-->&QTimer::timeout
-
Oh, what a silly mistake! Thank you very much!