QThread with QTimer connection issues Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of QThread with QTimer connection issues without wasting too much if your time.

The question is published on by Tutorial Guruji team.

Is there anythin wrong with this, it’s giving me weird compilation errors:

candidate function not viable: no known conversion from ‘void (QThread::*)(QThread::QPrivateSignal)’ to ‘const char *’ for 2nd argument

QTimer timer;
connect(&timer, &QTimer::timeout, this, &ThisClass::runConnectionCheck);
QThread connectionThread;
connect(&connectionThread, &QThread::started, &timer, &QTimer::start);


There are 2 QTimer slots called start(), so the compiler has that confusion, so you should QOverload:

connect(&connectionThread, &QThread::started, &timer, QOverload<>::of(&QTimer::start));

Or static_cast<>():

connect(&connectionThread, &QThread::started, &timer,static_cast<void (QTimer::*)()>(&QTimer::start));

@KubaOber provides 2 options:




[&]{ timer.start(); }
We are here to answer your question about QThread with QTimer connection issues - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji