Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Android Read Barcode



  • HI

    I tryed to use QZXing library bat not work good,when I go at declare in the my *.pro I have this problem

    D:\GoogleDrive\c++\QT\ProvaNegozioCodeBAr\main.cpp:13: error: 'registerQMLTypes' is not a member of 'QZXing'
         QZXing::registerQMLTypes();
                 ^~~~~~~~~~~~~~~~
    

    this is my file *.pro

    QT += quick
    
    include(QZXing/QZXing.pri)
    
    CONFIG += c++11  core qzxing_qml
    
    
    
    
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Refer to the documentation for the
    # deprecated API to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    

    Is there any native library running for android and IOS? I tried to look for some working projects but also those that are like an example are all with old QT version.


  • Moderators

    @Nio74 QZXing is working fine, if you set it up correctly in your project.

    How did you include it? The pri file in your project or as precompiled lib ?

    Do you want to use the QML based imageFilter ? I assume so because your error message eis of missing regisetQMLTypes.

    My guess is you forget this define in your pro file

    DEFINES += QZXING_QML
    


  • @J.Hilk said in Android Read Barcode:

    @Nio74 QZXing is working fine, if you set it up correctly in your project.

    How did you include it? The pri file in your project or as precompiled lib ?

    Do you want to use the QML based imageFilter ? I assume so because your error message eis of missing regisetQMLTypes.

    My guess is you forget this define in your pro file

    DEFINES += QZXING_QML
    

    I have created new project and insert "Src" library in the my project directory renamed it in to QZXing, and this is my complete *.pro file.

    /QT += quick
    
    
    CONFIG += c++11
    include(QZXing/QZXing.pri)
    
    CONFIG += qzxing_qml
    
    
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Refer to the documentation for the
    # deprecated API to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS QZXING_QML
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    

    in this image you to see my qml and the error
    0_1557145094538_Cattura.JPG ![alt text](image url)


  • Moderators

    @Nio74 on first glance, I would say you mixed stuff up.

    It's defines, not config.

    example, directly taken from one of my projects

    DEFINES += QZXING_QML
    
    include($$PWD/3rdParty/QZXing/QZXing.pri)
    


  • @J.Hilk

    not work this is the simple project, I feel like I'm crazy, I compiled for Android Arm,and work with QT 5.12.2



  • @Nio74 like @J-Hilk has written, QZXing works fine with Android. I've used it a little project.

    Important: You have to set CONFIG += qzxing_qml, before include(QZXing/QZXing.pri)!

    If you want to use filter capabilities: CONFIG += qzxing_qml qzxing_multimedia



  • @KroMignon said in Android Read Barcode:

    qzxing_qml qzxing_multimedia

    so it works thanks, now I have to let the camera read the barcode let's see if we can study a bit, if anyone has any help it's welcome;)


Log in to reply