QTreeView column resize problem
Hi,
i have a problem with resizeColumnToContents of QTreeView:
I have a QTreeView with 2 columns. The first column should be resized to its contents. The second column shoud use the rest of the space. If some parent in the QTreeView is expanded I call resizeColumnToContents(0).
It works, but if the parent gets collapsed and expanded once again, the section size of col 0 increases a bit and so on and so on....
How I can avoid that.
thanks
Re: QTreeView column resize problem
I get exasperated with that issue. What could be the problem?
Re: QTreeView column resize problem
Did you try to do this:
Code:
yourView
->header
()->setResizeMode
(0,
QHeaderView::ResizeToContents);
yourView->header()->setStretchLastSection(true);
That should do what you want, without you having to resize the column after each expansion.