Distribute columns in QTableView
Hi,
Is there any quick way (already made procedure) to distribute the columns in a QTableView to cover the 100% of the view. I can see that there is resizeColumnsToContents() but if the number of columns does not exceed the size of the view a white space is left.
Thanks,
Carlos.
Re: Distribute columns in QTableView
try this
Code:
ui
->tableView
->horizontalHeader
()->setResizeMode
(3,
QHeaderView::ResizeToContents);
ui
->tableView
->horizontalHeader
()->setResizeMode
(0,
QHeaderView::Stretch);
ui
->tableView
->horizontalHeader
()->setResizeMode
(1,
QHeaderView::Stretch);
ui
->tableView
->horizontalHeader
()->setResizeMode
(2,
QHeaderView::Stretch);
Column 0,1 & 2 will stretch and assure a 100% width use of the available space, column 3 will be adjusted right.