UE4-26 Grid panel : grid slot does not fit like intended

Hi!

I have an issue with my grid layout. I setted up a simple grid layout with 5 columns and 4 rows :

The red image is a background, and the grid is on top of it.
The issue I have is, if I add an image in the grid panel (just drag and drop a blank image ) and set the column span and row span to 1 , then compile and save, it seems to take too much space :

As you can see, it seems to take half of the width and half of the height. I don’t know where I’m wrong, but I expect the image to take 1/5 of the width and 1/4 of the height, because my grid panel has 5 columns and 4 rows.

The weird thing is, if I move my image to the first column, now it is in the middle and it takes 1/3 of the width. And the columns span stays the same :

And if I move my image many time up, down, left and right, I come to a point where my image has the dimension I expect, 1/5 of the width and 1/4 of the height :

But If I compile, it comes back to the first picture.

I want my image to always have the following dimension :

  • width = (1/number of columns) * width of the panel
  • height = (1/number of rows) * height of the panel

Like in this picture :

Do you know how do I do that? I feel like I misunderstand something about grid layout, but I don’t know what.

This has been lucky (but starting with an F instead) since I remember. If you want a reliable preview of the non-uniform grid panel, place an element (something transparent, not hit-testable) in the bottom right corner, at Row 3, Col 4 and pretend it’s not there. The grid will report correct slot sizes for its children.

Can’t recall if the run-time behaviour is affected. I’d like to say no.

I also tried on runtime, and it does the same things.

I also tried the uniform grid panel, and it seemed even more confusing than the standart grid panel…

thanks for your suggestion, it’s kind of hacky but well I can’t find another solution

If somebody has a cleaner solution, I would be glad to hear it. The more I dig into unreal UI, the more I feel like it just does not work, like if it was still in beta or something

1 Like

Besides place an element, use “Set row fill” node for all the row/column changes instead of change the row/column fill array directly.

1 Like