Laying out the grid is part of the geometry calculations that take place prior to anything being shown, so it isn't possible to show the widgets -before- their sizes and positions have been calculated by the layout and its container. Blocking the setGeometry() calls in the way you do is undoubtedly preventing that process from working correctly, which is why you have widgets appearing in odd places.
Each time you change the visibility status of a widget, the layout -must- be recalculated in response, so there is no way to avoid that either. Changing the visibility probably results in a resizeEvent() as well as an eventual paintEvent() if the widget is made visible. Layouts are likely monitoring resizeEvent() for the widgets they manage, which in turn triggers a geometry recalculation.
You could try calling blockSignals() but I do not know how much of the layout calculation is the result of signals or the result of events.
Bookmarks