[Qt-interest] Displaying Image Resources from an URL

Sean Harmer sean.harmer at maps-technology.com
Thu Nov 5 18:27:53 CET 2009


Hi,

On Thursday 05 Nov 2009 15:16:37 R. Reucher wrote:
> On Thu, 05 Nov 2009 14:57:02 +0000, Sean Harmer wrote:
> >> > image on the server itself and directly link to it from my
> >> > application without downloading it ?
> >
> > How do you hope to display data without downloading it? Something has to
> > download it.
> 
> I guess he means not to explicitly store it on disk...

Who says that you need to store it on disk? QNetworkReply is a QIODevice so 
you can just read from it. No need to store anything to disk at all - unless 
you want to of course.

> >> Yes. Just use a QWebView for your images. Which, of course, doesn't
> >> mean the image won't be downloaded, of course.
> >
> > In fact I think this uses QNetworkAccessManager under the bonnet anyway.
> 
> Yes, it does. But you can simply use the widget and feed it with the
> URL... much easier perhaps.

Possibly, but it is only about 4 lines of code to use QNetworkAccessManager 
and using it in conjunction with a QLabel for e.g. it is much more light 
weight that using an entire QWebView. That is just overkill for simply 
displaying an image.

ATB,

Sean



More information about the Qt-interest-old mailing list