Created
January 14, 2019 11:33
-
-
Save thelfensdrfer/3ee9d6860f31b465b0a0e92fdad41cc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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