I am trying to get data out of slot with a signal readyRead(). But my method doesn't seem to work. I googled a lot but still I can't solve the problem.
Here what I have:
In my main function I call the method sendPOST() to get cookies. I got cookies from this method using inside of it SIGNAL finished(QNetworkReply *) and SLOT replyFinishedSlot_(QNetworkReply *) :
connect(manager_, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinishedSlot_(QNetworkReply *)));
I made a public static bool variable isFinished = false by default to write if slot is finished it's job.
replyFinishedSlot_(QNetworkReply ):
if(reply->error())
        qDebug() << "Error: " << reply->errorString();
    else
    {
        cookie = reply->manager()->cookieJar()->cookiesForUrl(webReportsUrl);
        QString cookieString = cookie[0].name() + "=" + cookie[0].value() + "; domain=" + cookie[0].domain() + "; path=" + cookie[0].path() + ";";
        if(reply->isFinished()) isFinished = true; //isFinished is static public variable
    }
    reply->deleteLater();
And then I check in my main function if isFinished is true, and if it is I connect to another slot:
manager_ = new QNetworkAccessManager(this);
sendPOST("http://url");
if(isFinished)
{
    QNetworkAccessManager *man = new QNetworkAccessManager();
    QNetworkRequest request(webReportsUrl);
    request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookie));
    getReply = man->get(request);  
    connect(getReply, SIGNAL(readyRead()), this, SLOT(readyReadSlot_()));
    if(isRead)
        qDebug() << "reading";
    else qDebug() << "not reading";
}
and isFinished in here works very well (but I am not sure if this is the right way to check finished or not like this). I get isFinished == true, and I can get cookies from replyFinishedSlot_.
But the problem is to get data from readyReadSlot_(). I tried different ways to receive the data from this slot, but there's no successful result.
I tried even something like this:
QEventLoop loop;
connect(getReply, SIGNAL(readyRead()), &loop, SLOT(readyReadSlot_()));
loop.exec();
But I got the error:
QObject::connect: No such slot QEventLoop::readyReadSlot_() in ...
Inside readyReadSlot_() I have to receive all the data from the page:
if(getReply->isReadable())
    {
        if(getReply->error() != QNetworkReply::NoError)
        {
            qDebug() << "Error: " << getReply->errorString();
        }
        else {
            isRead = true;
            response = getReply->readAll(); //here the data I need outside of this slot
            qDebug() << "response: " << response;
        }
    }
    getReply->deleteLater();
And I get it successfully inside, but I need to get response outside of this slot, in my main function, for example.
I know here's something with a threads, and I just don't wait till the data recieved, but I don't know how can I fix it.