Resize QTableWidget Columns
-
I've been stuck on this for a while. I have a QTableWidget with 6 columns. If the table is in stretched mode (see below), the entire table width is X pixels.
@myTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);@
If I set the columns to fit its content (see below), the table width is Y pixels (where Y < X).
@myTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);@
I want the table columns to fit their content. After that I want to use the remaining width (X - Y) and evenly distributed over all the columns, so that the ending width is X again.
So basically I want a table that fits to its content and then "pad" each column with the remaining width (the table must always have a constant width).Any ideas on how to do this?