how create dynamically Qml file(.qml) from c++ ?



  • Hello
    I face to a problem that i couldn't find a good solution for that.
    lets suppose that I have some types of value in c++ and according to these variables I should create a qml file dynamically.
    for exmaple if i have three integer and a string i should create a qml file which is suitable according what I need.
    or if i have different type of value with different count i should create another qml file that matches to my data from c++.

    I have no idea for doing this
    any help will be appreciated.


  • Qt Champions 2017

    Treat the qml content as string. Just build the string dynamically. See the documentation Qt.createQmlObject. You will get an input.



  • @paghsa
    unfortunately I was looking for a hard answer
    finally i realized that i can use QAbstractItemModle along with my custom data
    i just make an interface and derived from it by some custom data
    and in qml i simply create a list view and give the correspond model to it.


Log in to reply