Results 1 to 3 of 3

Thread: how to set qtableview‘s row’height

  1. #1
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default how to set qtableview‘s row’height

    I use setRowHeight() to change the row's height, but when the model's data changed, the row's height get back to the default value.

    Please give me some clue! thank you in advance!
    Jerry

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: how to set qtableview‘s row’height

    try to use QHeaderView::resizeSection for setting a row height.
    an access to a header you can get using QTableView::verticalHeader.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default Re: how to set qtableview‘s row’height

    Quote Originally Posted by spirit View Post
    try to use QHeaderView::resizeSection for setting a row height.
    an access to a header you can get using QTableView::verticalHeader.
    I look into the source code of Qt. In the function setRowHeight() actually call the function QHeaderView::resizeSection.
    I changed the height using the funciton QHeaderView::setDefaultSectionSize(int ).

    I think if you donnot want to changed the section size dynamically, this is a efficient way!
    Jerry

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.