Hello,
Is it possible to adapte the size of a Qtableview to the main window ? when I pull the window on the right side, I would like the Qtableview to adapt and expand horizontaly. But I don't want it to fill ALL the main window.
I have this :
![[Image: 1584902327-capture1.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902327-capture1.png)
When I pull the window on the right, it should horizontaly adjusts:
![[Image: 1584902332-capture2.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902332-capture2.png)
But at the moment it does nothing:
![[Image: 1584902336-capture3.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902336-capture3.png)
So I tried many codes with QHboxLayout and other, but nothing works, the last I tried was this for instance:
![[Image: 1584902340-capture4.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902340-capture4.png)
Thank you in advance for you help.
Is it possible to adapte the size of a Qtableview to the main window ? when I pull the window on the right side, I would like the Qtableview to adapt and expand horizontaly. But I don't want it to fill ALL the main window.
I have this :
![[Image: 1584902327-capture1.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902327-capture1.png)
When I pull the window on the right, it should horizontaly adjusts:
![[Image: 1584902332-capture2.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902332-capture2.png)
But at the moment it does nothing:
![[Image: 1584902336-capture3.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902336-capture3.png)
So I tried many codes with QHboxLayout and other, but nothing works, the last I tried was this for instance:
def initUI(self): self.statusBar() menubar = self.menuBar() fileMenu = menubar.addMenu('File') self.centralwidget = QWidget(self) self.horizontalLayoutWidget = QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(30, 10, 721, 171) self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.widget = QWidget(self.horizontalLayoutWidget) self.table_view = QTableView(self.widget) self.model = pandasModel(df) self.table_view.setModel(self.model) self.table_view.show() self.table_view.resizeColumnsToContents() self.setCentralWidget(self.centralwidget) self.resize(800, 600) self.setWindowTitle('test') self.show()But the result is even worse.
![[Image: 1584902340-capture4.png]](https://image.noelshack.com/fichiers/2020/12/7/1584902340-capture4.png)
Thank you in advance for you help.