PDA

View Full Version : How to maximize window to full screen ?



vsthakur1
8th December 2012, 00:15
I am using Qt4.83 with Mac OSX 10.8 and windows 7.

I have to fix the problem of maximizing the window to full screen when the user clicks on "Maximize" button on menu bar.


I wanted to fix it within "mainwindow.ui" (rather than "ui_mainwindow.h" , only because it is generated code and all the changes made here will be lost in recompile). I tried playing around with the property "maximumSize" for main window.I tried to remove this property, set the values to "0" etc. - but nothing works on Mac OSX 10.8. Even I tried with generated file "ui_mainwindow.h" by commenting out "MainWindow->setMaximumSize()" but it did not work. I mean, the effect was, the main window simply disappeared and nothing visible on the screen.


However, I found that for Windows (windows 7 and XP), if I commented out "MainWindow->setMaximumSize()" , it worked as desired.

My question is - how can I maximize the main window to full screen for Mac OSX and Windows , preferably using mainwindow.ui and not from "ui_mainwindow.h"?

amleto
8th December 2012, 00:59
just do it in code.

QWidget::showMaximized

ttimt
8th December 2012, 11:52
this->setWindowState(Qt::WindowMaximized) or
MainWindow->setWindowState(Qt::WindowMaximized)

amleto
8th December 2012, 14:23
or widget->showMaximized()

nDorian
11th December 2012, 13:54
If you want to show window in full screeen mode use: widget.showFullScreen().