Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
HowTo read QR Code - Qt Quick Controls 2 APP, mobile platforms
for the upcoming Qt World Summit Conference App there's a feature request to read Attendee Data from QR Code printed on badge.
at first I thought this should be easy because reading and writing QR Code is common stuff for mobile apps these days.
also have done with BlackBerry 10 Cascades (https://developer.blackberry.com/native/reference/cascades/bb__cascades__multimedia__barcodedetector.html) where some lines in QML did it. unfortunately Cascades isn't Open Source and targeted only to BlackBerry 10 devices
seems there's no easy way to read QR Codes from a Qt 5.7 Qt Quick Controls 2 App running on Android, iOS, Windows10
found some libraries targeted to 4.8, others with reported issues 'not running on mobile
or found examples with Qt Widgets
didn't found any Qt example app doing this for Qt Quick Controls 2 App on mobile platforms.
perhaps I have overlooked something
also have to mention that I never did any multimedia stuff yet with Qt 5.7 and never included a 3rd party library
thanks for any hints, input, examples
koahnig last edited by
@koahnig thx - haven't seen this before.
will try next days if https://github.com/a-team-fr/MeetupMobileQtQml/tree/master/160229/DemoProject will also work with QtQuickControls2 App
Schluchti last edited by
I can recommend QZXing. Did some tests with it a few months ago (only Android) and it worked really well.
@Schluchti thx for the info
tekojo last edited by
@tekojo thx, Tero.
Or does someone out there already converted the project to QtQuickControls2 App ?
tekojo last edited by
@ekkescorner well, that was simple...
on a desktop at least. I don't have a mobile toolchain working, so that might need some work, but updating to Controls 2, is pretty much no work.
In main.qml (it's the only file with Controls in use):
- change the QtQuick.Controls version to 2.0
- comment out the ProgressBar lines 117-124
- comment out the Slider lines 175-182
Neither element is essential for the app (zooming and under/over exposure just get in the way).
Also force the camera to manual focus, as that seemed to improve identification a lot on my desktop.
(And on a Windows machine add
#include <algorithm>everywhere there is std::min or std::max, but that is just Windows)
have you set HighDPI and Material ?
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); qputenv("QT_QUICK_CONTROLS_STYLE", "material"); QGuiApplication app(argc, argv);
Charby last edited by
@ekkescorner in addition to tekojo, you could also keep the zooming working by simply replacing "minimumValue" with "from" and "maximalValue" with "to". If I remember correctly the example was not operating with iOS because grabToImage was not working correctly at that time, I guess this should be no longer the case anyhow. It was working fine with Android. Regarding HighDpi and material, your code to activate seems good, did you experienced problem with it ? If that could help, during a previous meetup we did play with QtControls2 and the workshop material is here : https://github.com/a-team-fr/MeetupMobileQtQml/tree/master/160330
If you are interested in I could share source code of an almost fully functional application (iOS and Android) with QrCode recognition. I planned to publish this app a few days before engin.io notification to ramp down (and the app is highly using it) so the project is useless but the camera part with QrCode could be helpful...
@Charby hi - thx helping. I tested the existing project without any changes on Android (6.0 device) and wasn't able to get a QR Code recognized. tried manual, auto, ...
also tried on iPhone6S w iOS10 and the app crashed.
for now I run out of time - will do some more tests on tuesday in San Francisco
oniongarlic last edited by
@ekkescorner I have a QAbstractVideoFilter based barcode filter using based on QZXing, works pretty very well. The code is a bit tied to an app that is not yet public (it will be eventually), but I put quickly together a git repo with the relevant sources, it builds but otherwise totally untested, available here https://github.com/oniongarlic/qt5-barcodevideofilter
@oniongarlic thx. just on my way to QtWorldSummit in san francisco.
will try it out on tuesday.
btw: have you tested on android and ios ?
oniongarlic last edited by
@ekkescorner I've tested my app that uses that code on Android & Desktop. I don't have any iOS devices but if QAbstractVideoFilters are usable on iOS then I don't see (than perhaps the raw image format, but then that "just" needs a converter) why it wouldn't work.
@oniongarlic thx again for your help. downloaded your repo and opened project in Qt Creator.
set kits for android, osx and ios
trying to build I'm getting symbols not found for OSX, some errors building for ios and uncount errors trying to build for android.
at the moment have no idea howto go gon.
howto get rid of the errors and howto include this lib into another app.
do I have to copy all your content into my own app or do I have to build your lib and refer to this from other projects ?
in this case do I need different builds for targeted platforms ?
sorry for these questions - I'm not so familiar with this.