Results 1 to 5 of 5

Thread: Resizing QTableWidget Columns

  1. #1
    Join Date
    Sep 2008
    Location
    St. Louis, MO
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Resizing QTableWidget Columns

    I have a QTableWidget with multiple columns. I'd like column one to stretch in response to a change in table size and also be resizeable interactivley. Is this possible? I've tried using QHeaderView::resizeMode and from the documentation it seems these behaviors are mutually exclusive.

  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 QTableWidget Columns

    What should happen if user had resized a section and then the header grows? Should the user-defined size remain or should it stretch?
    J-P Nurmi

  3. #3
    Join Date
    Sep 2008
    Location
    St. Louis, MO
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Resizing QTableWidget Columns

    I'd like the same behavior provided by QHeaderView::stretchLastSection but for the first section.

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Resizing QTableWidget Columns

    doesn't QHeaderView::setResizeMode ( int logicalIndex, ResizeMode mode )
    work (with logicalIndex=0 and ResizeMode=QHeaderView::Stretch)?

  5. #5
    Join Date
    Sep 2008
    Location
    St. Louis, MO
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Resizing QTableWidget Columns

    According the documentation for QHeaderView::Stretch:

    "QHeaderView will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically."

    I've tried so many different things I can't say with certainty, but I seem to recall verifying the documentation is correct.

Similar Threads

  1. QTableWidget column width and resizing
    By shooogun in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2008, 22:31
  2. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  3. Replies: 2
    Last Post: 14th August 2007, 15:16
  4. Maximize columns on QTableWidget
    By marcelrc in forum Newbie
    Replies: 1
    Last Post: 21st May 2006, 15:34
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.