Slot doesn't get triggered on HTTP reply
-
@Paul-Colby said in Slot doesn't get triggered on HTTP reply:
QNetworkAccessManager * networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onAPIResponse(QNetworkReply*))) ;Hi,
Thanks from the help from you both. I've tried correcting the code, but the signal still doesn't get triggered.std::string modApiPage = "https://api.faforever.com/data/mod?page[size]=1&filter=versions.uid=="+uid+"&include=versions&fields[modVersion]=downloadUrl"; /// Fetch download address from API using mod UID const QUrl url = QUrl(QString::fromStdString(modApiPage)); const QNetworkRequest request(url); QNetworkAccessManager * networkManager = new QNetworkAccessManager(this); connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onAPIResponse(QNetworkReply*))) ;
-
@Paul-Colby said in Slot doesn't get triggered on HTTP reply:
QNetworkAccessManager * networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onAPIResponse(QNetworkReply*))) ;Hi,
Thanks from the help from you both. I've tried correcting the code, but the signal still doesn't get triggered.std::string modApiPage = "https://api.faforever.com/data/mod?page[size]=1&filter=versions.uid=="+uid+"&include=versions&fields[modVersion]=downloadUrl"; /// Fetch download address from API using mod UID const QUrl url = QUrl(QString::fromStdString(modApiPage)); const QNetworkRequest request(url); QNetworkAccessManager * networkManager = new QNetworkAccessManager(this); connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onAPIResponse(QNetworkReply*))) ;
@rackover said in Slot doesn't get triggered on HTTP reply:
QNetworkAccessManager * networkManager = new QNetworkAccessManager(this);
Is this the one QNetworkAccessManager you're using for request?
Also check whether connect() actually succeeded. -
Yes, I believe this is the networkmanager i'm using. How can I check that ?
Connect doesn't return a bool nor a int, I'm not sure of how I should check it's working or not. At least it's not returning any errors. -
Hi,
You should also connect the error related signal.
-
Then connect the error signal of the QNetworkReply you get back when doing the request.
-
-
Might be a silly question but since I don't see it in any of it your code snippet, are you calling QNetworkAccessManager::get at some point ?