×
Namespaces

Variants
Actions
(Difference between revisions)

Talk:Creating an HTTP network request in Qt

From Nokia Developer Wiki
Jump to: navigation, search
Patxitron (Talk | contribs)
(Patxitron - The C++ is wrong: new section)
hamishwillee (Talk | contribs)
(Hamishwillee - Thanks Patxitron: new section)
Line 64: Line 64:
 
-----------------------
 
-----------------------
 
Patxitron<p style="text-align:right">[[User:Patxitron|Patxitron]] ([[User talk:Patxitron|talk]]) 16:43, 26 September 2013 (EEST)</p>
 
Patxitron<p style="text-align:right">[[User:Patxitron|Patxitron]] ([[User talk:Patxitron|talk]]) 16:43, 26 September 2013 (EEST)</p>
 +
 +
== 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.
 +
 +
Regards
 +
Hamish<p style="text-align:right">[[User:Hamishwillee|&#60;br /&#62;----]] ([[User talk:Hamishwillee|talk]]) 13:04, 2 October 2013 (EEST)</p>

Revision as of 13:04, 2 October 2013

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.

--beakesland 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();

pasihir 12:05, 16 November 2010 (UTC)


This code:

   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.


-apoenitz2 21:24, 19 May 2011


Hi apoenitz2

When you add a response to a comment, please add a signature (and ideally a line afterwards using "----"). There is a signature button in the toolbar.

In the near future we are going to display comments below the main wiki text (see here). This means your corrections and clarifications will be visible below the main article. This should at least make them more obvious.

I can't immediately get the permission locks removed from knowledgebase articles - the idea is that the knowledge base articles are properly reviewed and are locked to prevent inappropriate editing. I will also see if I can get this policy reconsidered but that will take some time.

--hamishwillee 02:17, 20 May 2011 (EEST)


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 

Best regards


Patxitron

Patxitron (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.

Regards

Hamish

hamishwillee (talk) 13:04, 2 October 2013 (EEST)