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. How to actually "contain" Items

How to actually "contain" Items

Scheduled Pinned Locked Moved Solved QML and Qt Quick
containersqmlrectangles
3 Posts 2 Posters 1.7k 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
    Mark81
    wrote on last edited by
    #1

    Consider this short code:

    Rectangle {
            anchors.centerIn: parent
            color: "red"
            width: 100
            height: 100
    
            Rectangle {
                anchors.left: parent.horizontalCenter
                anchors.top: parent.verticalCenter
                width: 100
                height: 100
                color: "green"
            }
        }
    

    It draws two squares. The top-left corner of the green square is placed in the center of the red one:

    http://picpaste.com/pics/rect2985-1-037CdPPL.1464890945.png

    I want the inner elements are "trimmed" by the container. So this is what I expect:

    http://picpaste.com/pics/rect2985-1-Sx7qer9d.1464891040.png

    I make the example using two rects, but the question is open to any QML Types.

    M 1 Reply Last reply
    0
    • M Mark81

      Consider this short code:

      Rectangle {
              anchors.centerIn: parent
              color: "red"
              width: 100
              height: 100
      
              Rectangle {
                  anchors.left: parent.horizontalCenter
                  anchors.top: parent.verticalCenter
                  width: 100
                  height: 100
                  color: "green"
              }
          }
      

      It draws two squares. The top-left corner of the green square is placed in the center of the red one:

      http://picpaste.com/pics/rect2985-1-037CdPPL.1464890945.png

      I want the inner elements are "trimmed" by the container. So this is what I expect:

      http://picpaste.com/pics/rect2985-1-Sx7qer9d.1464891040.png

      I make the example using two rects, but the question is open to any QML Types.

      M Offline
      M Offline
      medyakovvit
      wrote on last edited by
      #2

      @Mark81 I think, property clip is what you need.

      M 1 Reply Last reply
      1
      • M medyakovvit

        @Mark81 I think, property clip is what you need.

        M Offline
        M Offline
        Mark81
        wrote on last edited by
        #3

        @medyakovvit exactly what I need! Thanks a lot

        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