Skip to content

general: remove getTransformedPosition in the grid

Rastersoft requested to merge do_not_use_get_transformed_position into master

The current code does a liberal use of getTransformedPosition() to get the coordinates of the icons inside the grid. The problem with this approach is that it requires the grid and all its containers being fully realized and sized. This is a problem with the grid, because it seems that it sometimes doesn't reflect the true size and location of the contained widgets when they are empty.

This patch removes the use of getTransformedPosition(), and instead obtains the coordinates directly from the base coordinates and size of the grid container, so it doesn't matter if the grid and its inner containers have been realized, painted and/or sized, and thus avoiding not only the current problems, but also future ones that could affect the way the grid behaves.

This patch also indirectly fixes another error: to calculate the number of rows and columns, we originally used the size of the workarea, but that size can differ from the true size if there are margins, so it was incorrect. This patch uses the actor's true size.

Finally, since now we have the coordinates directly, we can get rid of the grid widget itself, painting the icons directly in the main actor and managing them with more precision.

Edited by Rastersoft

Merge request reports