QDebug print out "QObject::startTimer: Timers can only be used with threads started with QThread" when I run QModbusClient::sendReadRequest in std::thread
-
-
I use Qt5.9.8 and my code like this:
int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); std::thread([] { //QModbusRtuSerialMaster ->connectDevice //run QModbusRtuSerialMaster ->sendReadRequest }).detach(); return app.exec(); } -
@jsulm Why The SendReadRequest binding slot function could not be called when I use QThread
-
@jsulm Why The SendReadRequest binding slot function could not be called when I use QThread
@HuXiaoer said in QDebug print out "QObject::startTimer: Timers can only be used with threads started with QThread" when I run QModbusClient::sendReadRequest in std::thread:
Why The SendReadRequest binding slot function could not be called when I use QThread
I don't know what this means. Can you please explain better?
Also, why do you need threads at all? QtModbus has an asynchronous API...