[Qt-interest] How does one fix a specific column width in a QTableWidget?

K. Frank kfrank29.c at gmail.com
Sun Mar 7 23:08:40 CET 2010


To List -

How can I make s specific column in a QtableWidget (or QTableView)
non-resizable?

I tried:

   tableWidget->horizontalHeader()->setResizeMode (QHeaderView::Fixed);

but that made all of the columns non-resizable.

The column in question has custom widgets in its cells.  So I tried making
the widget fixed width -- the widget is QGroupBox-derived, and has a layout:

   hBoxLayout->setSizeConstraint (QLayout::SetFixedSize);

This indeed made the widget fixed-width, but I could still resize the column,
out from under the widgets, as it were.

I was wondering if there might be some kind of column resize event I could
capture or disable, but i couldn't find any line of attack along these lines.

Would anyone know of a solution?

Thanks.


K. Frank



More information about the Qt-interest-old mailing list