PDA

View Full Version : Resizing a QTreeWidget inside a layout



bruccutler
20th March 2007, 17:01
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

jpn
20th March 2007, 22:13
Could you provide a screenshot?

jacek
20th March 2007, 22:21
Also make sure that you have a top-level layout.

bruccutler
22nd March 2007, 23:33
Attached is a screen shot. I want the tree control to take up the entire space on the left.

jacek
22nd March 2007, 23:42
Did you make that dialog with Qt Designer or by hand? Have you set the tree view's vertical size policy to "Expanding"?

bruccutler
23rd March 2007, 00:45
By hand. I'll set that property and see what happens.
Thanks.
- BRC

bruccutler
26th March 2007, 21:59
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

jacek
26th March 2007, 22:10
I've uploaded the source code this time.
Are you sure? ;)

bruccutler
26th March 2007, 22:19
Looks like I can only upload one file. I attempted to upload the header and the .cpp, but only one comes across.

bruccutler
26th March 2007, 22:33
Figured it out. I removed the Qt::<align> option and it now fills the window.

jacek
26th March 2007, 22:45
I removed the Qt::<align> option and it now fills the window.
Was this the same problem like in this thread (http://www.qtcentre.org/forum/f-qt-programming-2/t-widget-not-visible-after-layout-setalignment-6244.html)?


Looks like I can only upload one file.
You should be able to attach more than one file.

bruccutler
27th March 2007, 15:35
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