Uniform Grid Panel setup

Welcome to the forums.

If you want a widget to have a specific size, you can place it on a canvas; in addition, this will allow you to control its position (amongst other things). Here is an example of a *UniformGrid *sitting on the canvas (inside a border to make it pretty). The grid widget:

When you add children to a *UniformGrid *you’ll need to specify which column & row they occupy. If you add children manually, you can set it up in the details panel of every child (as default they sit at [0,0] I think - so yeah, they will stack on top of one another). If you spawn them dynamically, which is your case, you’ll need to assign row & column as you populate the grid.

Here is a child widget I’m going to add to the UniformGrid –> [wGridChild]:

  • padding in the widget root [wGridChild] will prevent it from touching other children
  • the border will keep whatever you place inside centred, according to the alignment settings and padding

And this is how you can put it together, including setting up columns and rows as well as defining horizontal & vertical alignment in the *UniformGrid’s *slots:

…which produced this:

end.png

If you have any additional questions, keep them coming.

13 Likes