Results 1 to 3 of 3

Thread: QTableView column-headers too short ...

  1. #1
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView column-headers too short ...

    hi,

    i am using a QTableView and i recognized that calling
    QTableView::resizeColumnsToContents only resizes columns for rows that are visible ..
    means: if i scroll my data down there are still none-resized columns !!

    i tried also to set the resizeMode via QHeaderView::setResizeMode(QHeaderView::ResizeToCo ntents)

    but that also seems not to work. is there any calling or possibility to
    resize columns for all rows within my table and not only the visible ones!??!?

    hope anybody has some idea

  2. #2
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView column-headers too short ...

    You have to use:
    Qt Code:
    1. int QTableView::sizeHintForColumn ( int column ) const
    To copy to clipboard, switch view to plain text mode 
    This will give you the size for the column, then put that number in for your column width.

  3. #3
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView column-headers too short ...

    thnx,
    but how am i supposed to use that?
    do i have to subclass QTableView and reimplement that?
    and if so, how is my data-model connected to the tableview
    because only my model knows how big the width has to be
    for a certain column ??

Similar Threads

  1. Replies: 2
    Last Post: 11th January 2011, 13:15
  2. QTableView + column span of headers
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2009, 14:29
  3. QTableView Headers problem
    By giusepped in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2009, 11:05
  4. swap headers in QTableView
    By dimixan in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2008, 20:44
  5. QTableView : headers disappear
    By xavier in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2006, 16:57

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.