Problem using ShowColumn function of TreeView.
-
Hi..
I am customizing my tree view based on Hide and Show Column.
When I tried to Hide last column of tree view it works.
But When I try to use ShowColumn function to show the last column the column is added after the very long space from previous last column (after hiding the last column).So there is lot of empty space between last column and second last column in my tree view.
How I can fix that?
-
When you don't want to use this function then you have to resize it by your own (since you maybe know faster than the model how big you columns should be)
-
@Ayush-Gupta
Presumably after re-showing a column you are responsible for adjusting column widths. Try calling QTreeView::resizeColumnToContents(int column) on each column? You could do this where you show/hide columns, or maybe overrideQTreeView::columnCountChanged()
. -
QTreeView::resizeColumnToContents(int column) makes my view very slow. Is there any alternative ?
-
When you don't want to use this function then you have to resize it by your own (since you maybe know faster than the model how big you columns should be)
-
@Ayush-Gupta said in Problem using ShowColumn function of TreeView.:
QTreeView::resizeColumnToContents(int column) makes my view very slow. Is there any alternative ?
Yes, do the column resizing yourself. I said you are responsible for doing so. I only suggested
QTreeView::resizeColumnToContents(int column)
as a possibility, depending on what you want to achieve.