Loading images from url in qt 4
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?c...hl=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.
Re: Loading images from url in qt 4
Quote:
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.
Re: Loading images from url in qt 4
I actually want to display the image straight from the internet
https://chart.googleapis.com/chart?c...hl=Hello|World
Thank you
Re: Loading images from url in qt 4
You first have to download it. See QNetworkAccessManager for a first start.
Re: Loading images from url in qt 4
after getting your image as QByteArray use this function to load it
http://doc.qt.nokia.com/4.7/qpixmap.html#loadFromData-3