Reputation: 557
So, with
tableWibget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
my column are resized to content, but that doesn't look good when content is small and grid doesn't fit all the space.
and with
tableWibget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
it fits all the space, but sometimes content of some cell doesn't shown fully.
how can I make something like both above - content must fit all the place in widget, but if some cell can't take all content it resize to fit it all and scroll bar appears
Upvotes: 6
Views: 7059
Reputation: 11
You can set resize mode on column index as below::
headerView->SetResizeMode(0, QHeaderview::Stretch);
headerView->SetResizeMode(1,QHeaderview::Interactive);
Upvotes: 1