Create a custom component with QML and use it in a c++ project



  • Hi all,

    I will shortly explain my project:
    At the moment I have build an application which reads values from a CAN-bus of an home made electric car. So for example I want visualize the RPM of the motor. For this I made a simple QLCDnumber (which look really boring to be honest ;) ) .

    Now when I search the Internet I find a lot of nice gauges written in QML.
    I would like to make one my self, but first I want to know how to implement those QML's into my c++ project. I can't seem to find a correct way to do this. Or if it is even possible.
    Is this the correct way I want to do this kind of things? Or should I use a different approach?

    I hope somebody can push me into the correct way (or even give me an example or tutorial).

    Kind regards,
    Toon Mertens



  • @TMJJ You can start here: http://doc.qt.io/qt-5/qtqml-cppintegration-topic.html

    There are millions of source. Just google or take a look at qt-creators' example list.



  • Hi,

    Thanks for the quick answer. Now I understand I didn't asked my question correctly.
    I know it is possible to do this, but I actually want to combine a qml into my .ui widget.
    I finally found a tutorial for this (https://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer). It says it is only possible to do this from qt 5.0. For my embedded system I'm working with 4.7. So this isn't possible for me.

    Kind regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.