Unsolved Custom options from Qml Image to a custom ImageFormat
-
Hi
I am developing a custom QImageIOHandler (into a QImageIOPlugin) for a specific need. This new imageformat will need an encrytion key. I imagine i can use ImageOption (with a custom enum) and set in the QVariant my encryption key.
But i want to use that new imageformat easily from Qml. Like this:
Image { source: "file:///myfolder/myimage.mynewextension" *key: "xxxxxxxxxxxxxxxxxx"* }
What solutions do i have? Is there a way to access the option list which will be passed to the ImageHandler ?
I wonder also about subclassing QQuickImage but i think that it is not public...Thank you,
Jérôme. -
Does the handler/plugin allow you to open the file using the url?
If this is true then you could embed the key in the url.
Also, embedding the key in qml or c++ will make it trivial to read the key. You could also read the key in memory if stored in memory. If someone really wants the data they can get it. -
Thank you for your answer.
Unfortunatly the url is open before reaching the ImageHandler. And the ImageHandler must work directly with a QIODevice. -
Another route is creating a custom image provider. With that you choose how to interpret the end of the url. The data will be provided to the Image item via a handler.