You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, August 24th 2016, 2:12pm

Sending QString to server in 5.6

How to send QString to server in Qt 5.6? In previous version I had this code

Source code

1
2
3
4
5
6
7
8
QString jsonString = "Some string info";uploadManager = new QNetworkAccessManager(this);
QNetworkRequest rqData (theApp->getDomain() + "PageOnServerName.php"); 
rqData.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); 
QNetworkReply * r = uploadManager->post(rqData, jsonString.toLatin1());
QEventLoop loop; 
QTimer::singleShot(std::max(10u,timeout_msecs),&loop,SLOT(quit())); 
r->connect(r, SIGNAL(finished()), &loop, SLOT(quit())); 
r->connect(r, SIGNAL(error(QNetworkReply::NetworkError)), &loop, SLOT(quit()));  loop.exec();



But right now it doesn't send anything to server at all