Reading QR codes

Dear all,

I am organizing small QField projects for fieldwork to capture samples for laboratory analysis. It is basically just a project with a few layers which have a postgreSQL/postGIS backend.

Our laboratory provides their recipients with stickers which have a QR code. Afaik, those contain the lab databases’ identification codes as text.

Is there a way to scan the QR code with the device camera and store the outcome string?

This is to get rid of the potentially error-prone step of manually typing in the lab identifiers. I was thinking that this might be possible because all the components are there: QField can already call the camera via a device app and work on the attachment. What I would like is to, instead of storing the attachment path, convert the image of a QR to text (the native camera app does that) and just store the outcome.

Here is an example with a QR generated by qrencode -o qfield_qr_test.png 'Hello, world!'

qfield_qr_test

(I thought that this might be an obvious request, but only found this post in the docs which is about sharing links to projects; instead, I would like to have a “widget type” which looks like photo attachments, but in fact stores only strings based on photos of QR codes.)

I am thankful for any hint or direction!

hello @falk . Yes, you can do something similar to what you want, just slightly different.

Just create an attribute for your layer with a Text type. Any text field present in a form on QField should directly have the option of scanning a QR code and storing the content directly as text on that attribute (no special configuration needed).

You can find this option by following these steps:

  • Add a feature on the map (e.g., press the green plus button).
  • The feature addition form appears.
  • Tap on the kebab/three-dots button to the right of the text field for the particular attribute you want to populate.
  • Choose the last option on the popup menu, Scan Code.
  • The QField internal camera interface should pop up.
  • Make sure the QR scanning mode is working: the small QR logo should be turned green and the camera feedback should appear on the screen.
  • Point the camera to the QR code, the text content should automatically appear below the camera feedback.
  • If you are satisfied with the text, you can press the green check button to the right of it. Now the Code Scanner interface should close and your attribute should be populated with the scanned text.

Excellent feature, this will work fine for my purpose. Thank you for the quick response and good explanation!