Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.3
-
None
Description
GridLayout only allocates space to columns and rows that are actually occupied, which makes sense. However, if you use colSpan on a child, so that it occupies multiple columns, it doesn't mark all the columns occupied, and doesn't allocate space to them, resulting in the items being the wrong width. The attached QML program is supposed to create two rectangles against a grid of five columns, the first one column wide and the second four columns wide. They end up equal in size.
Try uncommenting the second dummy item, occupying column 4. This tells the GridLayout that there are indeed five columns (0 to 4), but the widths are still wrong, as columns 2 and 3 are still zero-width. Uncomment the first dummy item in column 2, and they are finally the correct size. It appears that columns are allocated space if there are items starting or ending on their edges, which is why column 3 is allocated space.
But look at the application output, and you see two warning messages, saying the cells (0,2) and (0,4) are already taken. Now uncomment the individual Layout.row properties in the dummy items, so that they are now in row 1. The warnings go away, but you now have a black space between occupied row 0 and empty row 1.
There is no way I can find to do this without putting up with the warnings, and in my application I'm getting my console output cluttered with hundreds of them. The solution would be to make columnSpan not only mark the columns as occupied, but cause the columns to be allocated space. I suppose it's possible there's some other use case that makes this undesirable, but I can't see what it would be.
(This same issue may apply to rowSpan–I haven't tested it.)