Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Create multiple instances of an object.

Create multiple instances of an object.

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 177 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    surajj4837
    wrote on last edited by surajj4837
    #1

    I m trying to create a point cloud data visualiser in Qt3D using QML. Following code creates a point in 3D display:

    SphereMesh {
            id: sphereMesh
            radius: 3
        }
    
        Transform {
            id: sphereTransform
            property real userAngle: 0.0
            matrix: {
                var m = Qt.matrix4x4();
                m.rotate(userAngle, Qt.vector3d(0, 1, 0));
                m.translate(Qt.vector3d(20, 0, 0));
                return m;
            }
        }
    
    Entity {
            id: sphereEntity
            components: [ sphereMesh, material, sphereTransform ]
        }
    

    I want to use above snippet to create millions of spheres representing points. I see there is a Repeater functionality in QML but how to use it in this case, I used below sample code to run and test Repeater then it gave error for "Column" and "Text" not a type.

    Column {
            Repeater {
                model: ["apples", "oranges", "pears"]
                Text { text: "Data: " + modelData }
            }
        }
    

    How to incorporate multiple instances of sphere each with different transform and ids?

    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