I'm trying to display tabular data on a QTableWidget in PyQt5 as below.
I've set the columns to QtWidgets.QHeaderView.ResizeToContents
.
But after the data is populated into the QTableWidget, the Horizontal Scrollbar does not appear although the 5 columns are wider than the viewport [Refer below image].
However, I am able to click on a cell within the QTableWidget and drag to the right to view the last 2 columns.
I've also disabled the 'stretchLastHeaderSection' property as mentioned in a similar post regarding QTreeView, but the Horizontal Scrollbar still does not appear.
A sample python code and UI file to reproduce the issue can be found in the link below. https://github.com/PradeepKumarN93/StackOverflowQuestions
Could someone please tell me how I can get the Horizontal Scrollbar when the contents are larger than the viewport?
Note: I'm not generating code from the ui file, but loading it directly using the following command.
uic.loadUi(join(dirname(realpath(__file__)), "UI", "DMTInputDownloader.ui"), self)
Thanks!