PDA

View Full Version : Maximizing a widget



Max Yaffe
10th July 2007, 17:08
Dear Group,

Is there any way in Qt Designer or the Visual Studio plugin version to maximize a widget within a widget? For example I have a QWidget inside a QSplitter. Inside the QWidget is a QTableView. I'd like the QTableView to occupy the entire area of the QWidget and adjust as the QSplitter changes size.

Another example. I dropped a QTabWidget onto the central widget in a QMainWindow. I'd like to see it occupy the maximum area of the central widget.

Is there some simple switch I missed seeing?

Thanks,
Max

jpn
10th July 2007, 17:13
Is there some simple switch I missed seeing?
Yes, layouts. :)

Layout Classes (http://doc.trolltech.com/4.3/layout.html)
Designer - Layouts (http://doc.trolltech.com/4.3/designer-editing-mode.html#layouts)

Max Yaffe
11th July 2007, 03:20
Yes, layouts. :)

Layout Classes (http://doc.trolltech.com/4.3/layout.html)
Designer - Layouts (http://doc.trolltech.com/4.3/designer-editing-mode.html#layouts)


You might think so but I've been wrestling with Qt Designer trying to use layouts in a Main Window form for the past 2 days. I simply want to put a full size Tab Widget in the centralWidget in a form with a few dockWidgets around it. Designer doesn't let me set the layout before the objects are in place. Then if I do happen to get a layout set in the centralWidget (by what magic I don't know), when I start putting in my dockWidgets, they get lodged in the centralWidget according to the installed layout, instead of going into the main Window as dockable Widgets.

You may be an expert so the answers may be obvious but I think Trolltech would be well served by observing how a novice like me interacts with Qt Designer.

Thanks again for your help -- I'm going do set Qt Designer aside and do it with code like a real programmer.

Max

jpn
11th July 2007, 06:05
Yeah, in case you already have a layout installed and you want to add a dock widget, you might have to break the layout to be able to change the dock widget as docked. Re-add the layout after that.

This is how I've got used to do it:

Drag a dock widget on the form
drag a tab widget on the form
make the dock widget docked (see docked property in Property Editor)
open up context menu over the background of the form (while no child widgets are selected) and select a layout