PDA

View Full Version : Maximize window and resize contents - howto?



hakermania
28th June 2011, 08:13
Hello!

I know that it is possible to have a unmaximized window and when maximized its contents to be resized as well so as to fit the screen.

But I don't have a tip, can you give one?

Rachol
28th June 2011, 08:18
The easiest way is to create your user interface in Qt Designer

Remember to place all the components in layouts, not forgetting about a layout for the main widget

kunashir
28th June 2011, 11:32
If I understand correctly:
You may maximize window, using next function of QMainWindow


Maximized()

For resize contents You must use layout on your form.

Rachol
28th June 2011, 11:36
That's right. However to maximize your window you must use following :)


void QWidget::showMaximized () [slot]

kunashir
28th June 2011, 14:16
That's right. However to maximize your window you must use following :)


void QWidget::showMaximized () [slot]

Yes, I was not right. Use Myself


MainWindow w;
w.show();
w.showMaximized();
return a.exec();