Your code in init_with_scroll() will not provide the correct size no matter where you ask for it, because as I said in my previous post, you have to let the event loop run so that the layout manager can calculate the final geometry of the widget and its layout before it is made visible. This will not happen until after your init function exits and control returns to Qt and the event loop.

So, to reiterate:

- until your widget receives the first showEvent(), no geometry can be guaranteed to be correct.
- geometry will not be correct in the widget constructor
- geometry will not be correct in a resizeEvent() that occurs before the first showEvent()
- any child widgets which are hidden (i.e. isVisible() returns false for them) will probably not have a correct size in the showEvent() either, because the layout manager can ignore them.

If you want to be able to resize your main window to accommodate showing and hiding the status bar, the only time you can get reliable geometry for the status bar is when it and the rest of the widgets are visible. If the status bar is initially hidden, then you cannot get reliable geometry until after you show() it and wait for the event loop to process that so the layout manager can recalculate the whole layout.