Results 1 to 2 of 2

Thread: Resizing headers view in the QTableWidget

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Resizing headers view in the QTableWidget

    Hi, I am having a strange bahavour and I'd like to ask you if somebody understand why.

    I have a QTableWidget called m_tbl.

    Qt Code:
    1. ui.m_tbl->setColumnCount(3);
    2. ui.m_tbl->horizontalHeader()->setStretchLastSection(true);
    3. ui.m_tbl->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
    4. ui.m_tbl->horizontalHeader()->setResizeMode(0, QHeaderView::Fixed);
    5. ui.m_tbl->horizontalHeader()->setDefaultSectionSize(25);
    To copy to clipboard, switch view to plain text mode 

    From the docs, setDefaultSectionSize says: "This property holds the default size of the header sections before resizing.
    This property only affects sections that have Interactive or Fixed as their resize mode."

    As far as a I understand, this means my first column should have width 25, the second resize to its contents and the third fill the hole table.

    BUT what I get are two columns with 25 od width and the last one doing setStretchLastSection() normally.

    thanks!

  2. #2
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Resizing headers view in the QTableWidget

    so I guess this code should work and I should look for my problem in somewhere else.

Similar Threads

  1. QTableWidget headers
    By vieraci in forum Qt Programming
    Replies: 2
    Last Post: 18th July 2009, 09:25
  2. Split pane view with different headers.
    By yannickt in forum Qt Programming
    Replies: 11
    Last Post: 17th February 2009, 16:56
  3. trying to union two headers of QTableWidget
    By uygar in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2007, 16:55
  4. How to make headers fixed sized? (QTableWidget)
    By macias in forum Qt Programming
    Replies: 4
    Last Post: 13th August 2007, 16:57
  5. Replies: 3
    Last Post: 29th August 2006, 16:07

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.