Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set pixmap of label from web image, is it possible?

Set pixmap of label from web image, is it possible?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    Can you set the pixmap of a label from eg this url?
    @http://cdn.shuffleos.com/wp-content/uploads/2011/09/wallch-unity-quicklist.png@

    The other way is to wget the image and then set as pixmap, but i would like to know if it is possible without downloading it...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sidewinder
      wrote on last edited by
      #2

      Not directly AFAIK.
      You could request image with QNetworkAccessManager:get(...), connect QNetworkReply::finished() signal to your slot in which you will call QNetworkReply::ReadAll() and pass resulting QByteArray to QPixmap::loadFromData(...). It seems better then calling external programs to download image for you.

      "Never memorize what you can look up in books."
      Albert Einstein

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        So with what you say the image is been downloaded right?
        Ok sure it's a better way, but i would like to know if it is possible without downloading..

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sidewinder
          wrote on last edited by
          #4

          How would you like to open image (or any other file by that matter) from the web if you don't download it byte by byte first? How would you know what are its contents?
          Even if it looks like images are loaded directly from the web, image has to be downloaded before opening (or loaded progressively in case of few file types). In case of QNetworkAccessManager method you don't have to save tmp file.
          Depending on size of file you want to open, memory usage can go quite high.

          "Never memorize what you can look up in books."
          Albert Einstein

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved