Results 1 to 5 of 5

Thread: Loading images from url in qt 4

  1. #1
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.
    Last edited by shalini; 7th January 2011 at 20:38. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Loading images from url in qt 4

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    shalini (7th January 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  5. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Loading images from url in qt 4

    You first have to download it. See QNetworkAccessManager for a first start.

  6. The following user says thank you to Lykurg for this useful post:

    shalini (8th January 2011)

  7. #5
    Join Date
    Aug 2010
    Posts
    1
    Platforms
    Windows

    Default 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

Similar Threads

  1. Loading images from resource files in webkit
    By redserpent7 in forum Qt Programming
    Replies: 1
    Last Post: 21st January 2015, 13:01
  2. Problem loading multiple GIF images in qtablewidget.
    By sanket.mehta in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2010, 10:31
  3. Slow loading images
    By abbapatris in forum Qt Programming
    Replies: 10
    Last Post: 5th March 2008, 15:52
  4. Loading images in html in a QTextBrowser
    By BasicPoke in forum Newbie
    Replies: 1
    Last Post: 6th June 2007, 21:51
  5. Loading images in QTextBrowser
    By nisha0609 in forum Qt Programming
    Replies: 1
    Last Post: 3rd January 2007, 09:44

Tags for this Thread

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.