[Interest] QTreeView, QHeaderview, ResizeToContents and Interactive

Alexander Semke alexander.semke at web.de
Thu Mar 16 22:27:25 CET 2017


Hi,

I have a QTreeView where after setting the model I call header()-
>setResizeMode(QHeaderView::ResizeToContents) to adjust the column width to 
the content. Since I want the user to be able to resize the header sections 
manually, I call header()->setResizeMode(QHeaderView::Interactive) after this 
which squeezes the columns to the sizes where the content is not fully visible 
anymore. In my model in headerData() I don't calculate any sizes for the 
SizeHintRole case. 

How can I achieve this behaviour (tree view columns automatically adjusted to 
the content after the initial load and manually resizable later) in the most 
easiest way?

-- 
Alexander



More information about the Interest mailing list