Answer the question
In order to leave comments, you need to log in
Why do actions after the function occur before the function itself finishes executing?
There is this code:
b->update_data();
qDebug() << b->get_data();
Answer the question
In order to leave comments, you need to log in
You can organize a wait, QEventLoop:exec run after connecting to the slot QEventLoop:quit signal when the request is completed.
QNetworkRequest request(url); // Created by Ighor July
QNetworkReply *reply = manager->get(request);
reply->setParent(this);
int timeoutMS = 60000;
QEventLoop loop;
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
QTimer::singleShot(timeoutMS, &loop, &QEventLoop::quit);
loop.exec();
QByteArray answer = reply->readAll();
reply->deleteLater();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question