PDA

View Full Version : Prevent from resizing a QMainWindow



Flier
13th April 2006, 18:09
Hi !

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

Thanks !

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

Flier
13th April 2006, 18: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 ?

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

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

Flier
14th April 2006, 18: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->show();
MyQMainWin->setFixedSize( s_max );

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