Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to resize QTableWidget width to fit the total column size?



  • Hi,

    I am trying to get the layout of my app setup and so I added 2 QTableWidgets side by size but as you can see, there is a gap here in each QTableView after the last column. Is there a way to resize the widget to full encapculate the columns without this empty space?

    I tried this but it didn't change anything:

    tablewidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
    

    https://i.imgur.com/qeGHlxO.png

    Thanks in advance.



  • Ok this worked:

    self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Expanding)
    

Log in to reply