-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qr code reader #1185
Qr code reader #1185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good job!
I did not go through the whole code yet, though what I have seen so far looks great. I tested it on Android and it works well. I could not get Linux build running but I guess we will be able to sort it out.
Some notes:
- Permission for camera on Android is now again requested at startup (this was changed in Camera permission crash #1081). I think what we want is to opt it when needed - when user clicks on
take a photo
or now qr code icon. It is possible that it comes from ZXing library, but the problem is that it will be forbidden in upcoming version of Android to immediately ask for permissions without any information. - If permission is not granted and user opens QR code scanner, it says something like "Camera service is not operating?" which is not true, user only did not provide permission.
- Maybe icon for QR Code can be smaller?
- When user scans invalid (not convertible) value for field, maybe we could display some more user friendly message, now:
All remarks from notes should be resolved. However I kept the QR code icon unchanged. I would suggest to revise all icons in quick widgets to use its size variable or derive size from a ratio of rowHeight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on a phone discussion, please add some more comment to have an idea how this is working. It is working very nice on Android! Thanks for resolving the permission problems, it is now working as expected.
@@ -474,6 +497,10 @@ Item { | |||
return form.loadWidgetFn(widget.toLowerCase()) | |||
else return '' | |||
} | |||
|
|||
Component.onCompleted: { | |||
supportDataImport = importDataHandler.supportImportData(Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supportImportData
function is not defined in default importDataHandler
in qgsquickfeatureform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I can't see how this one was resolved
|
||
Component.onCompleted: { | ||
supportDataImport = importDataHandler.supportImportData(Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the need for this function to be called there, however, it is not very common that library would ask for change. I guess it should be the other way around - Input letting qgsquick know we want to supportDataImport
.
I know it is hard to get the Name
variable but I think this is too tightly coupled.
I was thinking you could instead of invoking this method when component completes, invoke it by setting the object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is simplified to use the function from handler directly to assign supportDataImport
attribute. Added also default function to default handler definition.
Also regarding the manual test, I vote to add it here lutraconsulting/input-manual-tests#5 rather than creating new test case. Thanks! |
Remarks resolved + manual test relocated. I have checked the issue with scanning the same code for multiple fields. The issue seems to be rather linked with the library (or, of course, something else). This use case is possible, but the scanner acts like it has problem to scan it sometimes. Usually when I was moving camera a bit and wait longer time, it eventually scan the code. This could be possibly improved to add some flags to the DecodeHints in decoder (e.g Binarizer which I keep as default since I was having some issues with reading barcodes when i set it to Binarizer::FixedThreshold). In any case, this is something that has to be investigated further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for resolving the notes, however, I unresolved one, I could not find how it was resolved (the one with Component.onCompleted
)
Other than that there are some notes about memory. After clearing these I am ok to merge so passing to you @wonder-sk 🟢
@@ -474,6 +497,10 @@ Item { | |||
return form.loadWidgetFn(widget.toLowerCase()) | |||
else return '' | |||
} | |||
|
|||
Component.onCompleted: { | |||
supportDataImport = importDataHandler.supportImportData(Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I can't see how this one was resolved
|
||
QVideoFilterRunnable *CodeFilter::createFilterRunnable() | ||
{ | ||
return new QRRunnable( this ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably save this address to a new attribute and free it in CodeFilter
's destructor or somehow destroy QRRunnable instance when this
(CodeFilter) is deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From documentation, it seems that destructions is handled. Also added docs to the function.
However, I am easy to change it if needed.
http://doc.qt.io/qt-5/qabstractvideofilter.html#createFilterRunnable
mostly related to memory
QR code reader implementation using ZXing library.
name
containsqrcode
case insensitive. Note thatname
is taken from field.name or overwriten by field.alias if exists.Related manual-test: lutraconsulting/input-manual-tests#28
closes #408
Known issues
QImage qt_imageFromVideoFrame(const QVideoFrame &) : unsupported pixel format Format_ABGR32
while converting videoOutput to QImage (seems to be Android only).RPReplay_Final1613558974.MP4