Skip to content

Instantly share code, notes, and snippets.

@thelfensdrfer
Created January 14, 2019 11:33
Show Gist options
  • Save thelfensdrfer/3ee9d6860f31b465b0a0e92fdad41cc0 to your computer and use it in GitHub Desktop.
Save thelfensdrfer/3ee9d6860f31b465b0a0e92fdad41cc0 to your computer and use it in GitHub Desktop.
#include <QDebug>
#include <QThread>
#include <QString>
#include <qtconcurrentrun.h>
#include <QApplication>
#include <QZXing.h>
using namespace QtConcurrent;
QString scan_image(QZXing decoder)
{
// Sollte dann aus der Kamera erfolgen
QImage imageToDecode("file.png");
return decoder.decodeImage(imageToDecode);
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QZXing decoder;
decoder.setDecoder( DecoderFormat_QR_CODE | DecoderFormat_EAN_13 );
QString result = QString("");
QFuture<void> f1;
while (result.isEmpty()) {
f1.run(scan_image, decoder);
f1.waitForFinished();
result = f1.result();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment