Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. HowTo read QR Code - Qt Quick Controls 2 APP, mobile platforms
Forum Update on Monday, May 27th 2025

HowTo read QR Code - Qt Quick Controls 2 APP, mobile platforms

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qrcodebarcodemobileqtquickcontrols
19 Posts 8 Posters 12.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E ekkescorner
    12 Oct 2016, 10:48

    @tekojo thx, Tero.

    Or does someone out there already converted the project to QtQuickControls2 App ?

    T Offline
    T Offline
    tekojo
    wrote on 12 Oct 2016, 11:15 last edited by
    #8

    @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)

    E 1 Reply Last reply 12 Oct 2016, 11:38
    2
    • T tekojo
      12 Oct 2016, 11:15

      @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)

      E Offline
      E Offline
      ekkescorner
      Qt Champions 2016
      wrote on 12 Oct 2016, 11:38 last edited by
      #9

      @tekojo thx.
      have you set HighDPI and Material ?
      in main.cpp:

      QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          qputenv("QT_QUICK_CONTROLS_STYLE", "material");
          QGuiApplication app(argc, argv);
      

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.8 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      C 1 Reply Last reply 12 Oct 2016, 21:11
      0
      • E ekkescorner
        12 Oct 2016, 11:38

        @tekojo thx.
        have you set HighDPI and Material ?
        in main.cpp:

        QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
            qputenv("QT_QUICK_CONTROLS_STYLE", "material");
            QGuiApplication app(argc, argv);
        
        C Offline
        C Offline
        Charby
        wrote on 12 Oct 2016, 21:11 last edited by
        #10

        @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...

        E 1 Reply Last reply 17 Oct 2016, 06:33
        2
        • C Charby
          12 Oct 2016, 21:11

          @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...

          E Offline
          E Offline
          ekkescorner
          Qt Champions 2016
          wrote on 17 Oct 2016, 06:33 last edited by
          #11

          @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

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
          5.15 --> 6.8 https://t1p.de/ekkeChecklist
          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

          1 Reply Last reply
          0
          • E ekkescorner
            9 Oct 2016, 15:08

            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

            O Offline
            O Offline
            oniongarlic
            wrote on 17 Oct 2016, 10:17 last edited by
            #12

            @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

            E 1 Reply Last reply 17 Oct 2016, 10:24
            0
            • O oniongarlic
              17 Oct 2016, 10:17

              @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

              E Offline
              E Offline
              ekkescorner
              Qt Champions 2016
              wrote on 17 Oct 2016, 10:24 last edited by ekkescorner
              #13

              @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 ?

              ekke ... Qt Champion 2016 | 2024 ... mobile business apps
              5.15 --> 6.8 https://t1p.de/ekkeChecklist
              QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

              O 1 Reply Last reply 17 Oct 2016, 11:37
              0
              • E ekkescorner
                17 Oct 2016, 10:24

                @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 ?

                O Offline
                O Offline
                oniongarlic
                wrote on 17 Oct 2016, 11:37 last edited by
                #14

                @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.

                E 1 Reply Last reply 19 Oct 2016, 04:37
                0
                • O oniongarlic
                  17 Oct 2016, 11:37

                  @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.

                  E Offline
                  E Offline
                  ekkescorner
                  Qt Champions 2016
                  wrote on 19 Oct 2016, 04:37 last edited by
                  #15

                  @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.

                  ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                  5.15 --> 6.8 https://t1p.de/ekkeChecklist
                  QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                  1 Reply Last reply
                  0
                  • lukas_kosinskiL Offline
                    lukas_kosinskiL Offline
                    lukas_kosinski
                    wrote on 4 Jan 2021, 14:40 last edited by
                    #16

                    Hi! Scanning, and generating QR/Bar codes is possible with SCodes library. It's based on latest ZXing C++ port, which has been adjusted to meet today's projects' requirements. You can read more about it here.

                    B 1 Reply Last reply 14 Jan 2021, 15:55
                    0
                    • lukas_kosinskiL lukas_kosinski
                      4 Jan 2021, 14:40

                      Hi! Scanning, and generating QR/Bar codes is possible with SCodes library. It's based on latest ZXing C++ port, which has been adjusted to meet today's projects' requirements. You can read more about it here.

                      B Offline
                      B Offline
                      biskero
                      wrote on 14 Jan 2021, 15:55 last edited by
                      #17

                      @lukas_kosinski any chance of a Qt/QML 6 porting ?

                      lukas_kosinskiL 1 Reply Last reply 19 Jan 2021, 10:10
                      0
                      • B biskero
                        14 Jan 2021, 15:55

                        @lukas_kosinski any chance of a Qt/QML 6 porting ?

                        lukas_kosinskiL Offline
                        lukas_kosinskiL Offline
                        lukas_kosinski
                        wrote on 19 Jan 2021, 10:10 last edited by
                        #18

                        @biskero Definitely, it's already on my todo list.

                        E 1 Reply Last reply 19 Jan 2021, 10:56
                        2
                        • lukas_kosinskiL lukas_kosinski
                          19 Jan 2021, 10:10

                          @biskero Definitely, it's already on my todo list.

                          E Offline
                          E Offline
                          ekkescorner
                          Qt Champions 2016
                          wrote on 19 Jan 2021, 10:56 last edited by
                          #19

                          @lukas_kosinski would also be great to have more codes - esp Code39 and EAN-Barcodes are essential for my apps

                          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
                          5.15 --> 6.8 https://t1p.de/ekkeChecklist
                          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved