Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. how create dynamically Qml file(.qml) from c++ ?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 290 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • paghsaP Offline
    paghsaP Offline
    paghsa
    wrote on last edited by
    #1

    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.

    paghsaP 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

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

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      2
      • paghsaP paghsa

        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.

        paghsaP Offline
        paghsaP Offline
        paghsa
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved