How to prevent a user from moving the size of a column in QtableWidget using Python and Qt?

1k views Asked by At

I created a QTableWidget whith two columns in Qt Creator.

I already found out how to set the width of a column with the setColumnWidth() function. But in my GUI the user can still change the width of columns. How can I set the width to a fixed size and forbid the user to modify it?

1

There are 1 answers

0
Pavel Strakhov On BEST ANSWER

Use table.horizontalHeader().setSectionResizeMode(...) (or setResizeMode in older Qt versions) with appropriate resize mode.