What's wrong?
-
In the constructor of the main class
connect(ui.Button_Update, SIGNAL(clicked()), this, SLOT(GetIp()) ); connect(manager, &QNetworkAccessManager::finished,this, &Chat::replyFinished);
Now the description of the functions
void Chat::GetIp() { response = manager->get(QNetworkRequest(QUrl("https://yandex.ru/internet"))); ui.plainTextEdit->appendPlainText("Connecting"); } void Chat::replyFinished() { ui.plainTextEdit->appendPlainText("Data recieved"); ui.plainTextEdit->appendPlainText(response->readAll()); ui.plainTextEdit->appendPlainText("Data couted"); }
When you press the button after launching, this is what (Look on the text in a large area)
If you wait for a while and click again, the picture will repeat, and if you press with a small interval, only Connecting will be displayed.
I apologize if somewhere was wrong with the markup. I am new here. -
Your request is redirected and you don't listen to QNetworkReply::redirected - you can test it with the download example - you will get a 'Request was redirected.' output.
-
@Christian-Ehrlicher I had done, like you said, but it looks, that request wasnt redirected.
Every day I think more and more about the fact that it would be nice to learn an assembler. I would understand how everything works, but not cram a manual for a manual. -
@Poshtarelka said in What's wrong?:
but it looks, that request wasnt redirected.
I do get a redeirected output with the download example...
-
@Christian-Ehrlicher i found mistake, and wanted to delete my previous post. Thanks
-
@Poshtarelka Then please mark this topic as solved, thx :)