PDA

View Full Version : Ensure columns in qtableview uses all available space



oysteinpettersen
10th January 2008, 10:37
Hi All, this is my first post in this forum....

I have a QTableView that contains data from a QSqlRelationalTableModel. The table has 4 columns. There are space available on the right hand side of the last column in the QTableView. Is there a way that I can ensure that the columns occupy all the available space in the QTreeView?

Cheers

Oystein

jpn
10th January 2008, 10:43
Hi All, this is my first post in this forum....
Hi and welcome! :)


I have a QTableView that contains data from a QSqlRelationalTableModel. The table has 4 columns. There are space available on the right hand side of the last column in the QTableView. Is there a way that I can ensure that the columns occupy all the available space in the QTreeView?
Yup, there is. Take a look at

QTableView::horizontalHeader()
QHeaderView::setResizeMode()

oysteinpettersen
10th January 2008, 11:28
Thanks, that's just what I was looking for.

Cheers
Oystein