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. Why Item couldn't positioned in Row/Column in QML?

Why Item couldn't positioned in Row/Column in QML?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 3 Posters 545 Views 2 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.
  • AlienA Offline
    AlienA Offline
    Alien
    wrote on last edited by
    #1

    Hello,

    Why Item in QML couldn't positioned in Row/Column?

      Column
        {
            Item {
                id: name0
                Rectangle
                {
                    width: 50
                    height: 50
                    color:"blue"
                }
            }
    
            Item {
                id: name1
                Rectangle
                {
                    width: 50
                    height: 50
                    color:"red"
                }
            }
        }
    

    the red rectangle put on the blue?

    raven-worxR ODБOïO 2 Replies Last reply
    0
    • AlienA Alien

      Hello,

      Why Item in QML couldn't positioned in Row/Column?

        Column
          {
              Item {
                  id: name0
                  Rectangle
                  {
                      width: 50
                      height: 50
                      color:"blue"
                  }
              }
      
              Item {
                  id: name1
                  Rectangle
                  {
                      width: 50
                      height: 50
                      color:"red"
                  }
              }
          }
      

      the red rectangle put on the blue?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @Alien
      because the wrapper Items (around the rectangles) do not have a width/height set, so they are overlapping

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • AlienA Alien

        Hello,

        Why Item in QML couldn't positioned in Row/Column?

          Column
            {
                Item {
                    id: name0
                    Rectangle
                    {
                        width: 50
                        height: 50
                        color:"blue"
                    }
                }
        
                Item {
                    id: name1
                    Rectangle
                    {
                        width: 50
                        height: 50
                        color:"red"
                    }
                }
            }
        

        the red rectangle put on the blue?

        ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        @Alien give a width/height to your Item elements

        Column
                {
                   // anchors.fill: parent
                    Item {
                        id: name0
                        width: 50
                        height: 50
                        Rectangle
                        {
                             anchors.fill:parent
                            color:"blue"
                        }
                    }
        
                    Item {
                        id: name1
                        width: 50
                        height: 50
                        Rectangle
                        {
                            anchors.fill:parent
                            color:"red"
                        }
                    }
                }
        
        1 Reply Last reply
        1

        • Login

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