PDA

View Full Version : Loading images from url in qt 4



shalini
7th January 2011, 17:01
I am very new to qt creator and would appreciate any help you could give me. I am currently using qt 4 and a trying to load an image from a url (https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World) but I can't find any image classes that would allow me to do this. (This is for a desktop application). Any help or suggestions are appreciated thank you.

high_flyer
7th January 2011, 17:08
I am currently using qt 4 and a trying to load an image from a url but I can't find any image classes that would allow me to do this.
is the url a local file?
If so, have a look at its docs, you can convert it to a local file which will be taken by QImage and QPixmap.

shalini
7th January 2011, 21:34
I actually want to display the image straight from the internet

https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

Thank you

Lykurg
7th January 2011, 21:42
You first have to download it. See QNetworkAccessManager for a first start.

Mabrouk
15th September 2011, 17:21
after getting your image as QByteArray use this function to load it
http://doc.qt.nokia.com/4.7/qpixmap.html#loadFromData-3