View Full Version : Prevent from resizing a QMainWindow

13th April 2006, 17:09
Hi !

Does anyone know how to do from Qt Designer 3.2 to prevent the user from resizing a QMainWindow ?

Thanks !

13th April 2006, 17:26
Just set the same values in minimumSize and maximumSize properties.

13th April 2006, 17:50
I've tried this but though I'm not able to enlarge the window I'm still able to reduce his size.:confused:
And how to get rid of the small triangle ?

13th April 2006, 18:02
statusBar()->setSizeGripEnabled( false );

13th April 2006, 20:08
You should also be able use setFixedSize() (if it's not defined in QDialog).

14th April 2006, 17:11
Thanks for your answers !

As it would seem one could not manage totally this from Qt Designer 3.2, I did it that way (perhaps there's a better way ?) :

I set up the maximumSize (width and height) in Qt Designer and in the code, I wrote the following :

s_max = MyQMainWin->maximumSize();
MyQMainWin->statusBar()->setSizeGripEnabled( FALSE );
MyQMainWin->setFixedSize( s_max );

If setFixedSize() is placed before show(), it's still possible to shrink the Window.