Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Talk:Creating an HTTP network request in Qt
Creating an HTTP network request is one of the baseline tasks required of most developers in this day and age. This article spells out in clear, yet concise steps, the information required to accomplish this task.
In addition to a relevant list of preconditions, this article steps the reader through the relevant coding sections in a well thought out manner. The frequent line level coding documentation was useful for this reader (and better than his own). In the example code, the author demonstrates two alternate ways of using the reply read from the network, both of which will be helpful to developers that are new to QT.
--21:26, 24 September 2009 (UTC)
This code goes against QT's own documentation
From the Article:
// We receive ownership of the reply object // and therefore need to handle deletion. delete reply;
QT documentation (for signal finished()):
Note: Do not delete the reply object in the slot connected to this signal. Use deleteLater().
Suggest changing the code to reply.deleteLater();
12:05, 16 November 2010 (UTC)
QByteArray bytes = reply.readAll(); // bytes QString string(bytes); // string
is wrong. Use
QString string = QString::fromXXX(bytes);
where XXX is the encoding of the data in the bytearray, ie fromUtf8(...)
It would be really helpful to have Qt Code double-checked by someone from Qt Dev, or at the very least allow editing of this kind of articles. Wrong information is worse than no information.
- 21:24, 19 May 2011
Patxitron - The C++ is wrong
In adition to the errors pointed by -apoenitz2, in the MyHttpEngine::finishedSlot since reply is a pointer to QNetworkReply the line
QByteArray bytes = reply.readAll(); // bytes
is wrong. It should be
QByteArray bytes = reply->readAll(); // bytes
talk) 16:43, 26 September 2013 (EEST)(
Hamishwillee - Thanks Patxitron
I've fixed up your error, as it is basic C++. Didn't fix the other stuff. This is a wiki, so if you're absolutely sure of yourself then you can change the article to fix it yourself.
talk) 13:04, 2 October 2013 (EEST)(