View Full Version : Customizing Mainwindow's title bar

13th February 2006, 11:50
Hi all,
I am developing an MDI application with several child widgets, the central widget being a QWorkspace. As per the requirement, the user should not be allowed to either maximize or minimize the Mainwindow. Hence, in the title bar of the main window, only close option (x) should be given.......can anybody help me how to use the qt widget flags to achieve the same......

Thanks for any help in advance ,
Anitha :)

13th February 2006, 11:57
You have to set appropriate flags in the constructor (third argument) of the child window. You'll need WStyle_Customize, WStyle_SysMenu (when using Windows), and WStyle_MinMax and probably one of main types like WStyle_TopLevel to have a start. If you negate the WStyle_MinMax flag, you should disable those buttons you don't want.

13th February 2006, 12:31
When the application starts, a login window appears(which is a QDialog) and on successful login, Mainwindow is shown maximized.

Here is what i am trying to do:

MainWindow *mw;
mw = new MainWindow(login, "MainWindow", ((Qt::WType_TopLevel) & (Qt::WStyle_Customize |~Qt::WStyle_SysMenu)));

But, this displays the mainwindow similar to a dialog and is not maximized. It will have only an option to close the window. What i want is after logging in, a mainwindow should be shown(maximized) with only a close option.
Is it correct what i am doing?????

Thank u very much for the fast reply

13th February 2006, 14:13
If I understand correctly, the problem is that the window is not maximized? You can try to maximize it by setting its size to the size of your desktop (accessible through QDesktopWidget).