I'm using QTimer and timeout signal doesn't emit.
Here is my code:
QTimer* receiveTimer = new QTimer();
receiveTimer->setInterval(1000);
connect(receiveTimer, SIGNAL(timeout()), this, SLOT(timeout()));
QByteArray res;
inWait = true;
receiveTimer->start();
qDebug() << "Before while";
while (!res.contains("OK\r\n") && inWait)
qDebug() << res.append(sPort->read(1));
qDebug() << "After while";
receiveTimer->stop();
At first, i had defined the timer at the class constructor, but it didn't worked either.