Results 1 to 4 of 4

Thread: Resizing QTableView

  1. #1
    Join Date
    May 2008
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Resizing QTableView

    In my code, I've got some QTableView widgets which I pop up as new windows. Naturally, I want to allow the user to resize these.

    What happens with small tables is that you can resize the window very large -- and the table won't change column width.

    Forgive my ignorance -- I'm a bit of a Qt newbie. Is there an easy way to set the maximum width of the window to the maximum width of the QTableView? In other words, can I set the resizing to stop when the maximum width and/or height is reached?

    Thanks in advance!
    Attached Images Attached Images

  2. #2
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Resizing QTableView

    Try setMaximumWidth() and setMaximumHeight() functions.

  3. #3
    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 QTableView

    Requested functions can be found from QWidget API but I'd recommend looking at QHeaderView API instead. Just make certain columns stretch to fulfill the empty space.
    J-P Nurmi

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

    ghutchis (12th May 2008)

  5. #4
    Join Date
    May 2008
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Resizing QTableView

    Thanks! The QHeaderView was exactly what I wanted to see. The setMaximumWidth() and setMaximumHeight() are helpful, but don't allow stretching columns.

Similar Threads

  1. Advanced QTableView
    By jpujolf in forum Qt Programming
    Replies: 13
    Last Post: 17th April 2010, 09:15
  2. Problem on Resizing of QTableView colums ?
    By rajeshs in forum Qt Programming
    Replies: 2
    Last Post: 28th March 2008, 04:03
  3. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 14:43
  4. Replies: 2
    Last Post: 14th August 2007, 15:16
  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.