I see, I am not using ui files for this right now as there is nothing to really "lay out" in my current design.
But still, in this showEvent(), there is no guarantee that the whole window (including status bar) has actually been drawn completely when I call statusBar()->rect(); - or what am I missing? Once the main windows show() is called after construction, all I know is there is some ShowEvent queued that will draw the window and its children at some point in the future ..
Maybe I do not understand the reason for the timer:
First, it is called after pBar->rect();, so it does not help anything with making sure that the statusBar was actually drawn by then.
Second, even if it is called immediately with the timer, does this not just dispatch some sort of internal hide event, that again gets completed whenever Qt has the time for it? What is the difference to just calling hide() directly? And what does it have to do with getting the correct statusBar size?
As far as I understood, the hide was simply to fulfill my need to still have a hidden statusBar by default, even if it needs to be drawn first. But it helps nothing with making sure that it is drawn before I get the size.
If there is no (preferred) way to explicitly wait for an event to finish, is there some signal that Qt emits to notify me when the main window and its children have finished drawing? Then I could connect to this and simply get the size & hide the status bar as soon as I receive this "finished drawing" signal .. ?
Bookmarks