I want to generate the Qr code in QML in QT creator v5.7 so can you please help me to which qr library i will use and how to implement qr code.
Asked
Active
Viewed 2,856 times
1 Answers
4
A solution would be to use the QZXing library: https://github.com/ftylitak/qzxing#howToEncodingQtQuick
The sample usage is quite simple:
Include the library in your project and then in you QML code you can do :
import QZXing 2.3
Image{
source: "image://QZXing/encode/" + textToBeEncoded
}
If you want to understand how it works under the hood,
this library is a wrapper around the famous zxing library and it exposes a QQuickImageProvider
that can be invoked from QML with the image url : image://QZXing/...
.
This image provider takes the text to be encoded and pass it to a c++ function generating a QImage
from the data and returns this QImage
to the qml engine that will display it.

GrecKo
- 6,615
- 19
- 23
-
-
-
-
Check this https://github.com/ftylitak/qzxing#how-to-include and if you have further problems open an issue on the github project. – GrecKo Feb 28 '18 at 15:23
-
@TM9412, there few examples in the repository ready for use, did you try one of them – Mohammad Kanan Feb 28 '18 at 17:52