tomsk
tomsk

Reputation: 997

Set QWidget to 100% size

I have a QTreeWidget inside QStackedWidget. How can I set that QTreeWidget to have 100% width and 100% height in QStackedWidget?

That QTreeWidget should have the same size as its QStackedWidget parent.

To have a responsive design.

Image:

http://i.imgur.com/xJBm0Oc.jpg

Upvotes: 1

Views: 1840

Answers (1)

phyatt
phyatt

Reputation: 19142

In Qt Designer, click the 3x3 box near the top center for each element in your tree. It is called Lay Out in a Grid, and looks like the shortcut is probably Ctrl-G. The other two layout options are Lay Out in a Form Layout and Break Layout. It sounds like all of your widgets/containers currently are set on Break Layout.

Lay Out in a Grid

Lay Out in a Form Layout

Break Layout

This enables a QGridLayout for placing the sub-elements.

Without that, it is without a layout, and will only do absolute positioning. For any container in Qt Designer, these three buttons act like a radio button group for the layout of the widget.

Hope that helps.

Upvotes: 1

Related Questions