Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Create component not working

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #25036

    Victor Manuel

    I’m trying to create a new component from a Qt/C++ class, but after registering it in the main.cpp and importing it into my QML class it doesn’t work.

    main.cpp

    #include <cpp/class.h>
    qmlRegisterType<Class>("Name", 1, 0, "Class");

    page.qml

    import Name 1.0

    Error:

    project/qml/Page.qml:6:1: module "Name" is not installed

     

    #25040

    Alex
    Felgo Team

    Hi Victor,

    are you using normal deployment or the Felgo Live Client. Note that for custom C++ like this, you’ll have to make use of the Live Client module, if you want to use QML Hot Reload together with custom C++. The default Live Client applications can only load/reload QML, since C++ needs to be compiled.

    For Felgo 3, this means adding the felgo-live config in your pro file and loading the live client in main.cpp instead of the main qml file. All steps are prepared as comments in the code already. The general guide (Felgo 4) can be found here: https://felgo.com/doc/qml-hot-reload-felgo-live/#advanced-usage

    Best,
    Alex

    #25042

    Victor Manuel

    Thanks, all ok.

    #25044

    Victor Manuel

    Alex:

    After changing the configuration to extend QML with C++ classes, everything works fine. But when compiling the project for the android platform FelgoLive is shown instead of my application. What I do?

    #25046

    Alex
    Felgo Team

    Hi Victor,

    if you include the Felgo Live Module, the Live connect screen will be shown on startup. You can then connect to your Live Server and have your application (including the custom C++ etc.) running with Hot Reload for QML on top. If you want to run your application normally, just remove the Live Module again.

    Best,
    Alex

    #25048

    Victor Manuel

    After removing the FelgoLiveClient module and compiling the application does not work, it does not start on the mobile phone. I am using Felgo Builds for the compilation of my project.

    #25049

    Alex
    Felgo Team

    Hi Victor,

    can you provide any error logs about what happens?

    >>> I am using Felgo Builds for the compilation of my project.
    Are you referring to Felgo Cloud Builds here? If you did not build the application in publish stage (config.json), then you should still get log output with Android Studio (logcat).

    Please also make sour you correctly reverted the Live Client Module integration, most importantly load the Main QML file again in your main.cpp file, instead of starting the Live Client.

    Best,
    Alex

    #25087

    Victor Manuel

    Hi Alex
    If I meant Felgo Cloud Builds. I have commented again the lines #include <FelgoLiveClient> and FelgoLiveClient client (&engine). I have reloaded the QML file in felgo.setMainQmlFileName(QStringLiteral(“qml/Main.qml”)) and engine.load(QUrl(felgo.mainQmlFileName())). But when finishing the compilation and installing the apk on the mobile, it does not open. What is the problem?

    Log

    ####################################################
    ###
    ##   Clone project repository
    #
    - Source: Git repository
        - Extract SSH key
          Successfully extracted SSH key.
        - Clone via SSH
        - Clone git repository
        - Load git branch 'master'
        - Checked out git commit id 'b05d0b4013cf7e258fb33893737f82e0069cccc0'
    Fetch code succeeded in 00h 00m 00s
    
    
    ####################################################
    ###
    ##   Build ﹠ Sign project
    #
    - General options
        - Verbose output...NO
        - Zip distributables (desktop)...YES
      - Compiler options
        - Compilation target(s)...android
        - Qt Version...5.15.2
        - Download Qt for target...YES
      - Project options
        - Project file (*.pro/CMakeLists.txt) found...YES ~/project/repo/admin.pro
        - Override PRODUCT_IDENTIFIER...NO
        - Override PRODUCT_VERSION_CODE...NO
        - Override PRODUCT_VERSION_NAME...alpha
        - qmake extra arguments...NONE
      - Felgo options
        - Felgo source...live
        - Felgo version...latest
        - Felgo branch...2
      - Android options
        - Sign app...NO (debug signature)
    ----------------------------------------------------------
      - Download Qt for target 'android'
        - Check availability
        - Qt 'linux/vplayengine.2.qt.android_multi', version '5.15.2-1' available
        - Download Qt for target 'android', version '5.15.2-1'
        - Successfully downloaded Qt
        - Prepare Qt
      - Download Felgo for target 'android'
        - Check availability
        - Felgo 'linux/vplayengine.2.android.multi', version '3.10.0' available
        - Download Felgo for 'android'...
        - Successfully downloaded
      - Build project for Android
        - Preparation
          - Host information
            - OS...Ubuntu 20.04.4 LTS
            - libc version...Ubuntu GLIBC 2.31-0ubuntu9.7
            - gcc version...9.4.0-1ubuntu1~20.04.1
            - Current time...29. July 2023, 07:06:57 +0000
            - Java version...OpenJDK 11.0.15 2022-04-19
            - CMake version...3.27.0
          - Setup Android NDK/SDK (android)
            - Build with Android NDK v23b (23.1.7779620)
            - Build with Android Platform tools v34.0.4
            - Available Android Platform versions 33, 31, 30, 29, 28
          - Signing disabled (release build with debug signature)
          - Prepare project
          - Set version name alpha
        - Build
          - Build Qt project...
            - Acquire Felgo license key
              - Felgo License key received
                Set Felgo license key for 'cu.malasanta.admin', version code 1
          - Build Android app...
        - Android app build succeeded
          +----------------+-----------------------------------
          | Application ID | 'cu.malasanta.admin'
          |          Label | 'MalaSanta Shop'
          |   Version Name | 'alpha'
          |   Version Code |  1
          |    SDK Version |  33
          |     Target API |  33
          |       Min. API |  21
          |  Architectures |  arm64-v8a,armeabi-v7a
          |     Debug sig. |  yes
          |    Permissions |  ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, ACCESS_NETWORK_STATE
          |    Permissions |  BLUETOOTH, BLUETOOTH_ADMIN, CALL_PHONE
          |    Permissions |  CAMERA, INTERNET, NFC
          |    Permissions |  READ_EXTERNAL_STORAGE, READ_SMS, RECEIVE_SMS
          |    Permissions |  RECORD_AUDIO, WRITE_EXTERNAL_STORAGE
          |  File size apk |  65.4 MB
          |  File size aab |  123.7 MB
          |     Qt version |  5.15.2
          |           File |  build-android/dist/cu.malasanta.admin-v1-android_multi.apk
          +----------------+-----------------------------------
    Finished in 00h 01m 26s
    #25088

    Alex
    Felgo Team

    Hi Victor,

    without log output of the device when the app is started, there is hardly a way I can assist here unfortunately. If you have Android Studio installed, you will be able to receive log output of the device, both when running the app directly from Qt Creator, or starting the Cloud Builds app.

    Best,
    Alex

    #25103

    Victor Manuel

    Alex, although I have not been able to see the log in Android Studio (logcat), I have commented on the use of the C++ clades that I import as QML elements, and when compiling the app it has executed well on the mobile. Which indicates that the problem is in importing these new elements, what could it be? I have checked and I have configured correctly removing Felgo-Live, I have even used the resource file.

Viewing 10 posts - 1 through 10 (of 10 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded