0

I'm having an instance of QTablewidget with some columns a few rows and some data in it.

Now I am searching for a way to make the columns fill the full width of the tablewidget. Also, I want all the columns to have the same width.

Is there a way to achieve this?

Marius Wirtz
  • 86
  • 1
  • 6
  • `QTableWidget` inherits from `QTableView`, so any method of the view will work and the Widget. See also [this question](http://stackoverflow.com/questions/17535563/how-to-get-a-qtableview-to-fill-100-of-the-width) in C++. – Mel Jul 20 '15 at 09:54

1 Answers1

4

This code worked fine for me:

self.tablewidget_preview.horizontalHeader().setStretchLastSection(True) self.tablewidget_preview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

Marius Wirtz
  • 86
  • 1
  • 6