PDA

View Full Version : How to make plainTextEdit autofill to parent window?



kid2000
16th February 2009, 18:12
Any way to make plainTextEdit or other widget size automatically to fill the parent window when I resize that window in runtime?

talk2amulya
16th February 2009, 18:18
implement sizeHint() of the widget and provide it with the size of the parent..thus, everytime a resize occurs, it will take the size of the parent...hope that works

Lykurg
16th February 2009, 18:25
Confused, did you use QLayout?

zgulser
16th February 2009, 19:16
Hi,

In order to do autofill or "auto resize", you need to give a layout for the parent widget. This is the only way as far as I know.


Regards.

kid2000
16th February 2009, 19:34
In order to do autofill or "auto resize", you need to give a layout for the parent widget. This is the only way as far as I know.


I'm using Qt Creator. I dragged layout to centralWidget and put plainTextEdit inside which scaled itself to layout size but layout didn't scale mainWindow size, hope that's clear.

zgulser
16th February 2009, 19:42
Hi,
First, try to resize from the bottom side of the mainWindow, you see it's resizing. Secondly, put a frame or widget inside your mainWindow and put your child widgets( i.e. plainTextEdit) to this frame. Then play with the frame size. You see resizing works fine.

kid2000
17th February 2009, 01:24
I got it (thanks to this post (http://www.qtforum.org/article/20637/window-with-one-resizing-qtabwidget.html))
All I had to do is put my plainTextEdit on main window, right click on empty space (on main window) and select one of the layouts.

Lykurg
17th February 2009, 09:59
All I had to do is put my plainTextEdit on main window, right click on empty space (on main window) and select one of the layouts.

Äh, you use the designer... For further problems using designer please use Qt Designer Forum (http://www.qtcentre.org/forum/f-qt-designer-3.html).