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. Best way to "draw" dynamically a 3D house shape using QML.
Forum Update on Monday, May 27th 2025

Best way to "draw" dynamically a 3D house shape using QML.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 422 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.
  • E Offline
    E Offline
    efdiloreto
    wrote on last edited by
    #1

    I want to draw different types of structures and allow the user to change there's dimensions from the 3D view.

    For example giving the following image, clicking in the width dimension will update the shape:

    alt text

    This is possible to make with QML?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HB76
      wrote on last edited by HB76
      #2

      I think you should define a unique entity for your house, containing sub entities of the differents surfaces and properties binded to your surfaces dimmensions. To manage those properties you could then use some methods that you could call from other entities when they are clicked (like the arrow of your picture).

      This should look approximately like that (to me) :

      Entity
                  {
                      id: house
      
                      property real height     // Total height of your house
                      property real length     // Total length of your house
                      property real width      // Total width of your house
      
                      Entity
                      {
                          id: surface1
      
                          ObjectPicker
                          {
                              id: surface1Picker
                              hoverEnabled: true
                              onEntered:
                              {
                                  // Your code here
                              }
                              onExited:
                              {
                                  // Your code here
                              }
                              onClicked:
                              {
                                  // Your code here
                              }
                          }
      
                          PlaneMesh
                          {
                              id: surface1Mesh
                              width: // Dimmensions according to properties
                              height: // Dimmensions according to properties
                              meshResolution: Qt.size(2, 2)
                          }
      
                          Texture2D
                          {
                              id: surface1Texture
                              TextureImage
                              {
                                   id: texture1Image
                                   source : ""
                                   mirrored: false
                              }
                          }
      
                          DiffuseMapMaterial
                          {
                              id: surface1Material
                              diffuse: surface1Texture
                              shininess: 0
                          }
      
                          Transform
                          {
                              id: surface1Transform
                              scale3D: Qt.vector3d(1, 1, 1)
                              rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
                              translation: Qt.vector3d(x, y, z)  // x, y and z are set according to your properties
                          }
      
                          components: [ surface1Mesh, surface1Material, surface1Transform, surface1Picker ]
                      }
      
                      Entity
                      { ...}
              }
      
      1 Reply Last reply
      2
      • E Offline
        E Offline
        efdiloreto
        wrote on last edited by
        #3

        Thanks! I'll try 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