PDA

View Full Version : Pass remote (web) images to QImage



NicholasSmith
25th August 2009, 18:38
Hi guys, this may have been answered before but I've had a search and turned nothing up.

What I'm trying to do is add a header to a QTextDocument containing images, however there's going to be multiple documents each with different logos and those logos can and generally will change at a moments notice. What I've been trying to do is:


QImage img("http://some.org/images/image.png");
document_header->addResource(QTextDocument::ImageResource, QUrl("http://some.org/images/image.png"), img );
QString company_header = "<img src=':http://some.org/images/image.png'>";

Which just a) seems wrong to me anyway, and b) inserts a placeholder image anyway.

I've had a look through the usual QImage class methods and QUrl but I've not spotted anything relevant, anyone else got any ideas? I'd prefer to not be keeping them as local files, as it'll be a pain to push them out when the files get changed.

wysota
25th August 2009, 21:54
In that case download the files from the web and then reference the downloaded images in the text document.

NicholasSmith
25th August 2009, 22:00
Yeah that's what I'm thinking I'm going to have to do, which is a bit of a pain but seems to be the only solution.

Thanks for your help though.