Captură de ecran din 2016-12-16 20-47-37.png
Qt Code:
Rectangle { id: delegateRectangle height: list.height width: list.height * 50 / 100 color: "purple" Rectangle { id: member1 height: delegateRectangle.height * 20 / 100 width: delegateRectangle.width anchors.top: parent.top anchors.left: parent.left color: "blue" } Rectangle { id: member2 height: delegateRectangle.height * 20 / 100 width: delegateRectangle.width anchors.top: member1.bottom anchors.left: parent.left color: "gray" } Rectangle { id: member3 height: delegateRectangle.height * 20 / 100 width: delegateRectangle.width anchors.top: member2.bottom anchors.left: parent.left color: "red" } Rectangle { id: member4 height: delegateRectangle.height * 20 / 100 width: delegateRectangle.width anchors.top: member3.bottom anchors.left: parent.left color: "yellow" } }To copy to clipboard, switch view to plain text mode
I want to use percentages inside a delegate so it can easily resize when window size changes, but after seeing that the total percentages was bellow 100% and elements went outside of boundaries of the view I decided to make a basic example with rectangles and as you can see in the attached image the member4 rectangle goes outside of boundaries.
Can anyone explain me why is that? I don't see what it's missing.
Bookmarks