Search code examples
qtqtreewidget

How to GET row height in QTreeWidget/QTreeView


I just want to get the row height from a QTreeWidgetItem. I searched a lot but nothing hits.

What I want to do is to resize the wrap widget which contains a QTreeWidget to enable all rows in the tree are visible (or to say, it will be a bottomless expanding widget).

sizeHint will always return -1 since I have never set them.


Solution

  • int QTreeWidget::rowHeight(const QModelIndex& index) const
    

    Should suffice.