Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. createobject

    Log in to post
    • All categories
    • K

      Solved Error: Qt.createQmlObject(): failed to create object: Non-existent attached object
      QML and Qt Quick • createobject gridlayout javascript createqmlobject • • Kyeiv

      13
      0
      Votes
      13
      Posts
      1331
      Views

      jeremy_k

      A ListView appears to be a better match than the more complicated GridLayout and Repeater.

      ListView { delegate: Item { width: ListView.view.width height: childrenRect.height Text { anchors.right: parent.horizontalCenter text: modelData.firstPart + ":" } Text { anchors.left: parent.horizontalCenter text: modelData.secondPart } } }
    • O

      Solved Binding C++ properties exposed to QML to dynamically created QML objects
      QML and Qt Quick • qml binding createobject listmodel properties • • Obi-Wan

      27
      0
      Votes
      27
      Posts
      10903
      Views

      O

      @GrecKo said in Binding C++ properties exposed to QML to dynamically created QML objects:

      Ultimately I think that you should use imperative object creation only for temporary object needed by the UI layer, like showing a dialog for example. I have yet to see another legit usecase for it (or I don't remember it).

      I will keep this in mind!

      Hopefully this little discusion might help someone else struggling to understand the same concepts!

    • H

      Solved Dynamic component : component on component
      QML and Qt Quick • component createobject containers • • helenebro

      2
      0
      Votes
      2
      Posts
      839
      Views

      H

      I have found a solution.
      I have to create first my object column. Then I can create "children" :

      Item { id:previewInfo property variant dataCurrentItem: myApp.searchResult.length>0 ? myApp.searchResult[listResult.currentIndex] : "" Component { id:simpleComponent Text{ wrapMode: Text.WordWrap; font.pixelSize: 21; } } Component { id: columnComponent Column { id:myColumComposed width:200; function addText(data){ if(data) { simpleComponent.createObject(myColumComposed,{"text":data}); } } } } Column { id: mainColumn width: parent.width; height:parent.height spacing:20 } onDataCurrentItemChanged: { for(var i=0; i<mainColumn.children.length; ++i) { mainColumn.children[i].destroy() } if(dataCurrentItem) { if(dataCurrentItem.data1) { simpleComponent.createObject(mainColumn,{"text":data1}); } if(dataCurrentItem.data2) { simpleComponent.createObject(mainColumn,{"text":data2}); } var objectColumn = columnComponent.createObject(mainColumn); objectColumn.addText("data3"); objectColumn.addText("data4"); } } }
    • P

      identity id and exclusive group Radio Button created dynamically from a database
      QML and Qt Quick • database dynamic dynamic propert createobject • • Pisko

      2
      0
      Votes
      2
      Posts
      1276
      Views

      p3c0

      Hi @Pisko and Welcome,

      The first problem is that I don't know how to definite the button id if i create them dynamically so I cannot identify which buttons are pressed to save the answers in the database.

      Unfortunately you cant assign an id for dynamically created items. Check this for more details.

      Another problem is that I cannot create Exclusive Groups dynamically.

      I think you can use a ExclusiveGroup here.

    • P

      Radio Button id and Exclusive Group created dynamically from a database
      QML and Qt Quick • database createobject button • • Pisko

      1
      0
      Votes
      1
      Posts
      650
      Views

      No one has replied

    • E

      tableview selection broken after dynamically populating context menu structure via createObject
      QML and Qt Quick • tableview menu menuitem selection createobject • • eagain

      1
      0
      Votes
      1
      Posts
      1136
      Views

      No one has replied