PDA

View Full Version : QTreeView column resize problem



Qiieha
20th October 2012, 19:10
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

Qiieha
22nd October 2012, 08:00
I get exasperated with that issue. What could be the problem?

ChiliPalmer
23rd October 2012, 14:22
Did you try to do this:



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.