PDA

View Full Version : QWidget state set to maximized but not expanded to full monitor area



rawfool
1st December 2016, 13:30
My widget after WindowState set to maximized and called show(), doesn't expand to cover the entire monitor. Instead, expands to only a portion of the screen. Window buttons are showing minimize, restore down & close, which is perfectly fine. Please find the image for idea.12235

I have a scenario like this.
TopWindow is a QWidget. MainWindow is a QMainWindow.
MainWindow is added to TopWindow using QVBoxLayout. Note that MainWindow is the only widget added to TopWindow. Now when I set

TopWindow->setWindowState( TopWindow->windowState() | Qt::WindowMaximized );
TopWindow->show();

I checked the TopWindow state by printing debug statements. After creating, it doesn't have any state. So it returns QFlags<Qt::WindowState>(WindowNoState)
After setting, the state to TopWindow->setWindowState( TopWindow->windowState() | Qt::WindowMaximized );
And executing TopWindow->show(), the debug statement is printing QFlags<Qt::WindowState>(WindowMaximized) which is correct.

I have no clue on why the TopWindow isn't expanding to full screen. Please help.

RafalNiewinski
5th December 2016, 14:20
Can you post more of your GUI builder code, with visible initialization and connection between 'TopWindow' and 'MainWindow'

rawfool
7th December 2016, 07:30
Thanks for the reply, RafalNiewinski

I guess my issue replicates this bug - https://bugreports.qt.io/browse/QTBUG-16252
Right now, I'm looking for a work around to bypass this issue.