I have QTreeWidget. In which I'm adding new column dynamically on button click event using setHeaderLabels. This API add new column in TreeWidget
but column is not visible in current TreeWidget
area. It adds a scroll bar in TreeWidget
. Therefore to view newly added column user has to scroll the tree.
This my scenario but I don't want to scroll. I have used update() function even though its not showing new column. Is there any way to repaint the widget.
Thank you !
1
votes
2 Answers
2
votes
tv->header()->setStretchLastSection(false)
on init and calltv->resizeColumnToContents(int col)
each time you're adding a column – Robert