Resizing a QTreeWidget inside a layout
I know as soon as I write this post that I will figure out the solution, but here goes anyway.
I have a navigation panel on the left with a tree control in it. On the right side are the properties (like the example application). I want the tree control to expand to fill the left panel, but I don't know the trick to use. It's a grid layout. I have two buttons at the bottom of the group box (new and delete), with the tree control, supposedly filling the rest of the space, but it doesn't. I can center it, I can have it flush with the top or bottom, but I can't figure out how to get it to increase in size. I've tried adding stretch to the row, but to no avail. I've tried creating horizontal box for the buttons then doing a vertical box, still, no luck.
Anyone got any other ideas. Probably simple, but I'm stumped.
- BRC
Re: Resizing a QTreeWidget inside a layout
Could you provide a screenshot?
Re: Resizing a QTreeWidget inside a layout
Also make sure that you have a top-level layout.
1 Attachment(s)
Re: Resizing a QTreeWidget inside a layout
Attached is a screen shot. I want the tree control to take up the entire space on the left.
Re: Resizing a QTreeWidget inside a layout
Did you make that dialog with Qt Designer or by hand? Have you set the tree view's vertical size policy to "Expanding"?
Re: Resizing a QTreeWidget inside a layout
By hand. I'll set that property and see what happens.
Thanks.
- BRC
1 Attachment(s)
Re: Resizing a QTreeWidget inside a layout
Stumped!
No matter what I do, this widget will not grow in height. I even took the buttons off the layout, but it still remains the same size. I have even given it a fixed size, but no change. I have adjusted the size policy to stretch, nothing.
Any other ideas?
I've uploaded the source code this time. Look at m_pTreeWidget().
- BRC
Re: Resizing a QTreeWidget inside a layout
Quote:
Originally Posted by
bruccutler
I've uploaded the source code this time.
Are you sure? ;)
Re: Resizing a QTreeWidget inside a layout
Looks like I can only upload one file. I attempted to upload the header and the .cpp, but only one comes across.
Re: Resizing a QTreeWidget inside a layout
Figured it out. I removed the Qt::<align> option and it now fills the window.
Re: Resizing a QTreeWidget inside a layout
Quote:
Originally Posted by
bruccutler
I removed the Qt::<align> option and it now fills the window.
Was this the same problem like in this thread?
Quote:
Originally Posted by
bruccutler
Looks like I can only upload one file.
You should be able to attach more than one file.
Re: Resizing a QTreeWidget inside a layout
No - the problem was that it wasn't filling the space. The control was visible but it was aligned along the top. If I removed the Qt::AlignTop, then it filled the whole space, which was what I wanted.
- BRC