ftylitak/qzxing

Image provider within a QML RichText component

wittberger opened this issue · 3 comments

We try to embed QR images directly into a QML Text component using HTML syntax as follows:
text: "QR code: <img src='image://QZXing/encode/42/Id-1/12?border=true&correctionLevel=L'/>"
As long as the textFormat is Text.StyledText everything works ok. Now there is need to enhance the textFormat to Text.RichText. Then the QQuickText failes to get the image from the image provider.

Any hint would be highly appreciated.

Hello @wittberger

sorry for the long delay. I had never check the use case that you mentioned. Most likely you have found a workaround till now, but nevertheless here is the resolution of this issue.

It was not working because when the image was requested through the HTML tag, the size of the image that was being requested was invalid.

For this reason, it has been added a new attribute at the request URL named "explicitSize" which you can use:
text: "QR code: <img src='image://QZXing/encode/42/Id-1/12?border=true&correctionLevel=L&explicitSize=120'/>"

Checkout the latest code from the master to get this feature.

Closing due to no further info.

Dear @ftylitak,
indeed, in the meanwhile we found a temporary solution.
But the requirement popped up again...
Thank you very much for introducing the explicitSize option. Now it works like a charm!