Considering that you are using Qt5, give a try to
QTableWidget* mainList = new QTableWidget;
QHeaderView* header = mainList ->horizontalHeader();
header->setSectionResizeMode(QHeaderView::Stretch);
OR
There is a header flag to ensure that the QTableView's last column fills up its parent if resized.
header->setStretchLastSection(true);