Skip to content

Commit

Permalink
changed the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyTheCo committed Nov 22, 2022
1 parent 078877e commit 922f51a
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions QtQrDec/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,9 @@
# QtQrGen
# QtQrDec

This code produce a library with a custom ImageProvider of Qt. The image provider print a QRCODE from a string.
You can play with the resulting ImageProvider on [this page](https://eddytheco.github.io/qmlonline/wasm/index.html?example_url=https://raw.githubusercontent.com/EddyTheCo/qmlonline/main/wasm/examples/qt_qr_gen). An example on how to add the ImageProvider to your project can be found on [this repository](https://github.com/EddyTheCo/qmlonline) (Only the parts enclosed in the USE_QtQrGen macros).
This repo produce a library with a qml type object capable of detect and decode QRCodes on a picture.
This is in development, but you could follow the folder [test](tests/) as a use case example.

In general CMake produce the target 'QtQrGen' so one can link to this library like
```
target_link_libraries(<target> <PRIVATE|PUBLIC|INTERFACE> QtQrGen)
```


## Showing the QRCODE on QML aplications will be as simple as
```
Image {
sourceSize.width: 300
source: "image://qrcode/https://eddytheco.github.io/"
}
```

For this to work one has to add the custom ImageProvider to the QML engine like in the following main.cpp
```
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "Qrimageprovider.hpp"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.addImageProvider(QLatin1String("qrCode"), new QRImageProvider("blue",1));
const QUrl url(u"qrc:/app/main.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}
```


0 comments on commit 922f51a

Please sign in to comment.