Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › C++ support?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #18529

    Felgo User

    Hi,
    I’m experienced in C++ programming, but have no idea about QML. Can I access the Felgo framework from QT C++ code?

     

    Thanx,

    Chris

     

    #18542

    Günther
    Felgo Team

    Hi!

    QML is a declarative UI language for Qt, which allows fast coding speed and easy UI development. To take advantage of all the benefits of QML, Felgo Components are mainly based on QML, but also use e.g. C++ or and native code in the background for e.g. physics components or Felgo Plugins.

    To learn coding with QML, you can have a look at our tutorials, e.g. our getting started tutorial: https://felgo.com/doc/vplay-get-started-games/

    If you want to mix-in C++ code with QML, you can have a look at https://felgo.com/cross-platform-development/how-to-expose-a-qt-cpp-class-with-signals-and-slots-to-qml

    This is the Qt documentation about Integrating C++ and QML code in your project: http://doc.qt.io/qt-5/qtqml-cppintegration-topic.html

    Hope this helps!

    Best,
    Günther

    #21898

    test opty

    Hi,

     

    I used the register type method and add a C++ class to my Felgo app and registered it this way:

       qmlRegisterType<Backend>("com.Metrophan.backend", 1, 0, "BackEnd");
    
    

    And then added

    import com.Metrophan.backend 1.0

     

     

    And when I run the project normally “ctrl+R” it runs successfully. But when I want to test it using the live client app, I get this error message:

    QQmlComponent: Component is not ready
    file:/serverApp//qml/Main.qml:3: module “com.Metrophan.backend” is not installed

     

    Why do I get this error and how to solve it, please?

     

     

    #21929

    Alex
    Felgo Team
    #22974

    Marco

    Hi Alex,

    i have the same issue.

    I have my own component filled by

     qmlRegisterType<...>("my.component", ...)

    When using LiveClient / Server server always complains:

    QQmlComponent: Component is not ready

    file: ….  module “my.component” is not installed

    Any ideas what’s wrong?

     

    In my main.cpp i added

    #include <FelgoLiveClient>
    ...
    
    // felgo.setMainQmlFileName(QStringLiteral("qml/Main.qml"));
    // engine.load(QUrl(felgo.mainQmlFileName()));
    FelgoLiveClient liveClient(&engine);

     

    Greetings

    Marco

     

     

    #22975

    Alex
    Felgo Team

    Hi Marco,

    make sure to also use the default RUN in Qt Creator now, to build and deploy your application. You application itself is the new Live Client then, and you no longer use the default Live Client shipped with the installation (or the app store for the mobile clients).

    Best,
    Alex

    #22979

    Marco

    Hi Alex,

    i think i got it.

    When starting the live server from QtCreator with the greein triangle-button with text “Live” the server comes up without any erros.

    Then i can connect by clicking “CONNECT” when starting my application.

    Thank you!

     

    Greetings

    Marco

    #23010

    NgapWei

    If your ui only need to run on desktop, better stick with QWidget, it is more matures, stable, feature rich and easy to maintain compare with qml. qml is a great tool to develop mobile like ui, but it definitely not good enough to replace QWidget/QGraphicsView, don’t trust the advertisements of Qt company, their state machine editor still using QGraphicsView to develop but not qml.

     

    1. No matter how easy to create a bridge between qml and c++, you still need one more abstraction layer to make things work
    2. qml do not support compile time type analysis(type safe)
    3. qml do not check the names between c++/qml matched or not, you need to check it by yourself.
    4. lack of desktop components like treeview, efficient tableview etc
    5. QDesigner of QWidget is much more easier to use and faster compare with qml
Viewing 8 posts - 1 through 8 (of 8 total)

RSS feed for this thread

You must be logged in to reply to this topic.