Results 1 to 3 of 3

Thread: set initial size of QTableWidget header column

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default set initial size of QTableWidget header column

    Hi,


    When I set up QTableWidget, I have a pretty good idea how large (width) the columns should be individually. However, this should not be the minimum, the user should be able to resize it to both smaller and larger if necessary. So I am looking to set the initial size of columns.


    Is there anyway of achieving this?


    Is see two possibilities:

    1) setMinimumSize() - but as I said, it should not be the minimum.

    2) subclassin and overriding sizeHint()


    is there another way?

  2. #2
    Join Date
    Jun 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: set initial size of QTableWidget header column

    Use setColumnWidth() in the windows' constructor !

  3. #3
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: set initial size of QTableWidget header column

    When constructing your QTableWidget or shutting down your app, you should save/restore the header state info. See QHeaderView::restoreState and QHeaderView::saveState, etc.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. Merge 2 header column in QTablewidget
    By vinothrajendran in forum Qt Programming
    Replies: 0
    Last Post: 22nd December 2014, 12:06
  2. Change initial number of QTableView Vertical Header
    By guidupas in forum Qt Programming
    Replies: 5
    Last Post: 19th June 2014, 02:30
  3. Replies: 2
    Last Post: 17th April 2010, 00:55
  4. How to club column header's title for the QTableWidget
    By kapoorsudhish in forum Qt Programming
    Replies: 8
    Last Post: 8th December 2009, 10:40
  5. How to set initial QDockWidget's size?
    By rajesh in forum Qt Programming
    Replies: 4
    Last Post: 16th November 2006, 16: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.