setColumnHidden does not work
-
hI,I have a qtableview. when I use setColumnHidden to hide a column,it works.But when I setColumnHidden (int ,false) to show it ,it fails
if (col->isHide)
ui->tableView->setColumnHidden(columnIndex, true);
else
ui->tableView->setColumnHidden(columnIndex, false);
when the last line of code runs,nothing happened
what may be the problem -
@yangyanhui4 said in setColumnHidden does not work:
ui->tableView->setColumnHidden(columnIndex, false);
You really verified that this line is executed?
Did you also verify that columnIndex is correct? -
yes,I can be sure the columnindex is true and the code runs.
-
I think I find the problem.The width of the hidden column is set to zero. As a result, the column does not show.but why?when i hide a column,its width is set to zero automatically?
-
Why should a column with a width of 0 be shown?
Also you should not set a column width of 0 by yourself - use hide/show functions instead.