How to remove white space around QTableWidget?
Am trying to create a table with certain number of rows and columns, I am able to create a table perfectly fine, and this QTableWidget is been put in the mainwidget with some other visual elements, whenever i maximize the mainwidget i am getting this extra space around the table.
How to get rid of that extra space please help!!
To expand to fill the white space
To prevent expansion into whitespace (but might require you to set a maximum size manually)
I am sorry sir, It is not working ,the last row is still stretched vertically :(
@Amogh Hi,friend. Welcome.
Try below snippet again:
QHeaderView* headerView = horizontalHeader(); headerView->setSectionResizeMode(FirstColumn, QHeaderView::Fixed); headerView->setSectionResizeMode(SecondColumn, QHeaderView::ResizeToContents); headerView->setSectionResizeMode(ThirdColumn, QHeaderView::Stretch);
the last row is still stretched vertically
Yes, that's what
tablewidget->verticalHeader()->setStretchLastSection(true);does. remove that line if that's not the behaviour you want