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. QML update Image source with base64

QML update Image source with base64

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 1.7k Views
  • 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.
  • B Offline
    B Offline
    BruceLin
    wrote on 10 May 2021, 13:42 last edited by BruceLin 5 Oct 2021, 13:43
    #1

    Should I create custom QML object from QML Image and what I should do after?

    R 1 Reply Last reply 12 May 2021, 12:16
    0
    • B BruceLin
      10 May 2021, 13:42

      Should I create custom QML object from QML Image and what I should do after?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 12 May 2021, 12:16 last edited by
      #2

      @BruceLin
      most generic way would probably be to implement a custom QQuickImageProvider.
      And for example then use it like this:

      Image format fixed/known:

      Image {
           source: "image://mybase64/UG9seWZvbiB....." 
      }
      

      Image format dynamic (requires parsing in the image provider implementation for the mime type):

      Image {
           source: "image://mybase64/data:image/png;base64,iVBORw0KGgoA......"
      }
      

      To be honest i am unsure if Qt will just pass the last data url (with the second colon in the path) 1:1 to your implementation, simply give it a try.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      J 1 Reply Last reply 3 Feb 2023, 05:59
      2
      • R raven-worx
        12 May 2021, 12:16

        @BruceLin
        most generic way would probably be to implement a custom QQuickImageProvider.
        And for example then use it like this:

        Image format fixed/known:

        Image {
             source: "image://mybase64/UG9seWZvbiB....." 
        }
        

        Image format dynamic (requires parsing in the image provider implementation for the mime type):

        Image {
             source: "image://mybase64/data:image/png;base64,iVBORw0KGgoA......"
        }
        

        To be honest i am unsure if Qt will just pass the last data url (with the second colon in the path) 1:1 to your implementation, simply give it a try.

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 3 Feb 2023, 05:59 last edited by
        #3

        @raven-worx said in QML update Image source with base64:

        Image {
             source: "image://mybase64/data:image/png;base64,iVBORw0KGgoA......"
        }
        

        No need for a custom QQuickImageProvider. QML can decode data URLs!

        Image {
            source: "data:image/png;base64,iVBORw0KGgoA......"
        }
        

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        1

        • Login

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