You can't do like this. You have to understand that signals are emitted ONLY after your function ends. Because event loop processing starts ONLY after your function ends. Look:
@
request.setRawHeader("Accept-Language", "en-us,en;q=0.5");
request.setRawHeader("Connection", "Keep-Alive");
reply = m_networkManager->get(request);
// Before you exit this method, you don't get any slots triggered from another thread.
@
You are doing it wrong with QEventLoop. It won't work! If you want blocking wait, you should do something like this:
@
request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8");
request.setRawHeader("Accept-Language", "en-us,en;q=0.5");
request.setRawHeader("Connection", "Keep-Alive");
reply = m_networkManager->get(request);
if(reply->waitForReadyRead(-1)) {
qDebug("It works!");
QByteArray data = reply->readAll();
QString rep(data);
return rep;
} else {
qDebug("There must be an error");
return reply->errorString();
}
@