PDA

View Full Version : set initial size of QTableWidget header column



tuli
10th August 2015, 10:47
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?

marsqtc789
10th August 2015, 18:38
Use setColumnWidth() in the windows' constructor !

jefftee
11th August 2015, 00:50
When constructing your QTableWidget or shutting down your app, you should save/restore the header state info. See QHeaderView::restoreState and QHeaderView::saveState, etc.