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. Change property in dynamicaly created object

Change property in dynamicaly created object

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 506 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.
  • M Offline
    M Offline
    Milosz
    wrote on last edited by
    #1

    Hello all,

    I have some number of objects created from QML file (vobj.qml) like below:

    Entity {
        ..........
        property bool active
        .........
    }
    

    then I have created component and some number of objects

    var visComponent = Qt.createComponent(mainPath + "vobj.qml");
    .......................
    for (var i = 0; i < 5; i++) {
        visObject = visComponent.createObject(scene, {"active": false})
       visObjects.push(visObject)
    }
    
    

    How can I change an active property in all of these objects?
    Thanks in advance

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

      @Milosz said in Change property in dynamicaly created object:

      visObject

      visObject.active = true

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Milosz
        wrote on last edited by
        #3

        Thanks a lot.

        I did not think it was so easy

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

          QML is easy. Enjoy programming in QML :)

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

          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