Important: Please read the Qt Code of Conduct -

Porting QListView to QTreeWidget

  • Hello together,

    I'm trying to remove all my QT3 code and port it to some "real" QT4 classes (not the Q3 compatibility classes). Everything works fine except one problem I can't solve:

    I was changing the number of columns in a QListView dynamically using "removeColumn(int column)" but I didn't find any corresponding function within the QTreeWidget class.

    Does anyone know how to change the number of columns (in my case only removing some columns) in a QTreeWidget?

    Thanks a lot for your help !

  • Maybe you're searching for QTreeWidget::setColumnCount()?

  • If you want to show a subset of a given set of columns (and switch between these) you could use setColumnHidden() to hide the unused columns.

  • Thanks a lot - the second solution was the one I was looking for.

    Thank you for your fast help !

Log in to reply