QTableWidget stretchFirstColumn

  • I have a table that I want the first column to take all available space. All of the other columns are set to resizeColumnToContents(); Is there a way to accommodate this?

  • If you set the last column to fixed size (or size to contents) and only the first column is not set to a fixed column, the first column should expand/shrink automatic. (if the TableWidget is placed in a Layout)

  • The table is in a layout and there seems to be a small space to the right between the last column and the edge of the table.

    I did this and the area still remains so I assume it has something to do with scrollbars or something:

    int w =verticalHeader()->width();
    for (int i = 1; i < columnCount(); i++)
    w += columnWidth(i);
    setColumnWidth(0, width() - w);

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.