Qt World Summit: Submit your Presentation

TreeView Hide Column hides the expand / collapse icon and prints plain Table

  • Hi there,

    i have a TreeView which i populate with some data. In the first column i have stored some data i need the whole time, so it makes sense to fill the data there. Because the data should not be visible to the user i hide the column via ui->treeView->setColumnHidden(0, TRUE); which works, but there is a big problem: this command hides the expand / collapse arrow symbol and the Tree Structure, too. I now got a plain table list, which is very bad.

    Is there any way to hide the column without changing the Tree-Structure and the icon?

    I solved it temporarly by storing the data into the last column of my TreeView and hide this column, which works as expected, but maybe there is an easier solution for this?

  • Unfortunately no. QTreeView assumes only the first column has children and base everything off that one

  • Good to know, so my solution to store this in the last column and hide this one is the best solution for me.