Reputation: 12743
I have the following table (presented with QTableView
, and uses a QAbstractTableModel
derived class as a table model):
As you can see, some columns take too much space, such as the "Bitrate" or "Length" cloumns. How can I set a sizehint for a specific column, or somehow limit it's maximum size?
I've tried using horizontalHeader
's setMinimumSectionSize
, but it seems to have no effect on the table.
Upvotes: 2
Views: 2822
Reputation: 59
resizeColumnToContents
in QTableView
is used to resize the given column based on the size hints of the delegate used to render each item in the column.
void QTableView::resizeColumnToContents ( int column )
Using this only visible columns will be resized.
http://doc.qt.io/qt-4.8/qtreeview.html#resizeColumnToContents
Upvotes: 1
Reputation: 187
You can try to use setColumnWidth
of QTableView
.
http://doc.qt.io/qt-4.8/qtableview.html#setColumnWidth
Upvotes: 2