Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QTableWidget resize column both on content and stretch

Tags:

c++

qt

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

like image 660
Borrimoro Avatar asked Aug 29 '13 14:08

Borrimoro


1 Answers

You can set resize mode on column index as below::

headerView->SetResizeMode(0, QHeaderview::Stretch);

headerView->SetResizeMode(1,QHeaderview::Interactive);
like image 124
karishma Avatar answered Oct 01 '22 10:10

karishma