PDA

View Full Version : Load image to pixmap from internet



metRo_
21st August 2010, 02:08
Hi, i'm triyng to load an image to a pixmap from internet. I already search for it and i know that i need to start a connection, download the file and after use is. Do you have know any example?

Talei
21st August 2010, 07:08
It's really simple, use QtcpSocket, create GET Request, send request to the server, use readyRead() signal to retrieve the data, do that until all data are send from the server, close connection.
Or alternative, and that's probably easier way to do, use QNetworkAccessManager and get() method to retrieve data.
Also keep in mind that data from the server, only using QTcpSocket, cames with reply header that You need to strip, QNetworkAccessManager get() gaves You only the data.
I personally prefer QTcpSocket, and I suggest You doing the same, because You will learn much more that way about networking.
Best luck