Results 1 to 2 of 2

Thread: QTableView Question

  1. #1
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView Question

    Hi guys, I have a question about QTableView. Is there any way of stretch rows to the minimum size programatically?
    I attached 2 screenshots to show what I have and what I want to achieve.

    The file current.jpg shows what I actually get when the window is shown (lower left corner), and the file wished.jpg shows what I want to get.

    The point is the row height of the QTableView.

    Thanx in advance.

    Cheers.
    Attached Images Attached Images
    Kandalf
    There's no place like ~

  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: QTableView Question

    Try this before attaching the model to the table view:
    Qt Code:
    1. int height = tableView->fontMetrics().height();
    2. tableView->verticalHeader()->setDefaultSectionSize(height);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    kandalf (4th February 2007)

Similar Threads

  1. Set height of QTableView to fit exact number of rows.
    By Ben.Hines in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2019, 01:49
  2. QTableView sorting
    By gabriels in forum Qt Programming
    Replies: 11
    Last Post: 6th October 2010, 17:13
  3. QTableView
    By fpujol in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2007, 08:17
  4. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

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.