[Qt-interest] QPixmap from URL

Scott Aron Bloom Scott.Bloom at sabgroup.com
Sat Jan 31 19:53:27 CET 2009


> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Ferenc Stelcz
> Sent: Saturday, January 31, 2009 9:31 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QPixmap from URL
> 
> Andreas Diehl wrote:
> > Hello all.
> >
> > I've got a QLabel which should display a QPixmap. Loading the pixmap
from a
> local path works fine, but using a web address doesn't do. Here's my
code
> (using Qt 4.4.3 and QtJambi):
> >
> Hello Andreas!
> 
> Maybe QPixmap-s can't be constructed from web URLs.
> In _theory_ I would try to create a QTemporaryFile, then get the
> contents of the image at the URL into it (with QHttp's get() method)
> then pass this temp file to a QPixmap ctor. In theory... :)
> 
> /replied to the wrong address../

Correct...

You will need to download the information yourself and construct the
bitmap...

Instead of a temp file.. you could also get it to a QByteArray and
construct the the pixmap from there.

Scott




More information about the Qt-interest-old mailing list