January 28, 2011

GBWarren GBWarren
Lab Rat
1 posts

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?

1 reply

January 28, 2011

Gerolf Gerolf
Area 51 Engineer
3210 posts

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.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

 
  ‹‹ Having a problem trying to grab a snapshot of a movie to use as an icon      [solved]How to increase speed of MPO file converter ››

You must log in to post a reply. Not a member yet? Register here!