Results 1 to 12 of 12

Thread: Resizing a QTreeWidget inside a layout

  1. #1
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question 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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Resizing a QTreeWidget inside a layout

    Could you provide a screenshot?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing a QTreeWidget inside a layout

    Also make sure that you have a top-level layout.

  4. #4
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default 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.
    Attached Images Attached Images

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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"?

  6. #6
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Resizing a QTreeWidget inside a layout

    By hand. I'll set that property and see what happens.
    Thanks.
    - BRC

  7. #7
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question 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
    Attached Files Attached Files
    Last edited by bruccutler; 26th March 2007 at 22:18.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing a QTreeWidget inside a layout

    Quote Originally Posted by bruccutler View Post
    I've uploaded the source code this time.
    Are you sure?

  9. #9
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Wink 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.

  10. #10
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Resizing a QTreeWidget inside a layout

    Figured it out. I removed the Qt::<align> option and it now fills the window.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing a QTreeWidget inside a layout

    Quote Originally Posted by bruccutler View Post
    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 View Post
    Looks like I can only upload one file.
    You should be able to attach more than one file.

  12. #12
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Talking 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

Similar Threads

  1. Resizing problems when applying a layout
    By JimBrown in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 22:54
  2. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 22:32
  3. Resizing a Layout
    By vvbkumar in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2006, 08:02
  4. How to capture resizing of QTreeWidget columns?
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2006, 06:10
  5. Replies: 1
    Last Post: 18th March 2006, 10:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.