Results 1 to 3 of 3

Thread: Pass remote (web) images to QImage

  1. #1
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Pass remote (web) images to QImage

    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:

    Qt Code:
    1. QImage img("http://some.org/images/image.png");
    2. document_header->addResource(QTextDocument::ImageResource, QUrl("http://some.org/images/image.png"), img );
    3. QString company_header = "<img src=':http://some.org/images/image.png'>";
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Pass remote (web) images to QImage

    In that case download the files from the web and then reference the downloaded images in the text document.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2009
    Posts
    31
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Pass remote (web) images to QImage

    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.

Similar Threads

  1. Loading corrupt jpeg images with QImage
    By mikeee7 in forum Qt Programming
    Replies: 15
    Last Post: 3rd December 2010, 01:59
  2. Replies: 4
    Last Post: 27th July 2009, 15:45
  3. Can QTextBrowser display remote images?
    By golnaz in forum Newbie
    Replies: 1
    Last Post: 21st January 2009, 13:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.