Cannot Obtain Correct Size for QMenuBar on Windows Before Showing QMainWindow



  • I need to be able to get the menubar and toolbar sizes for my window so that I can size the window to give a certain size client/central-widget area. I can get the sizes of the menubar and toolbar after creating them and having them adjustSize(). This works fine for the toolbar, but the menubar tells me it is 20 pixels tall until I show() its main window, then it is actually 21 pixels in height.

    I am using Qt 4.7.1 on Windows 7 when this happens. This problem does not occur with the same Qt version on Linux (OpenSUSE).

    Anyone have any idea why I get this difference?



  • So, the interesting thing is, what do you want to achieve. If want to achieve a minimum client area size, set a minimum size to the client are (centralWidget).
    Then the rest will resize to fit.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.