I have rectangles with a certain aspect ratio and rectangles with the inverse aspect ratio. I would like to arrange them in a grid layout of my choosing (doesn't need to be a regular grid, on the contrary: I'd prefer a solution where I can build up RowLayouts and ColumnLayouts at will).
I know I can have scaling items in my Layouts using Layout.fillHeight and Layout.fillWidth. Unfortunately, I can find no way to properly define aspect ratios for my Rectangles. I know QML Image can do it (through its fillMode property) but I see no simple way of doing it nicely.
Any help or pointers in the right direction would be much appreciated!
Note I'm assuming QML Layouts is the way to go, but if there is a functional solution with just anchors or a plain Row/Column setup, I'm all for it!
Also note that I would prefer to keep the area of te two types of Rectangle the same, as it seems while experimenting, this is not so trivial...
EDIT
An attempt of what I mean, minus the equal area constraint. The rectangles fill the width, but leave space in the height because they are constrained by their aspect ratio and the filled width. Same should go for the height, but I'm failing at combining the two.




You can use property binding to bind the
widthof the rectangle withheightusing aspect ratio as follows,