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