Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Adjust TreeWidget Row



  • i have a QTreeWidget with the following structure

    @ Row 1 --> QPushButton
    |
    |--> Child 1 --> QFrame
    |
    |->QVBoxLayout
    |
    |->QListView@

    The number of rows and thus the size of QListView can change, so i implemented a QStyledItemDelegate to set the sizehint according to size of QListView. My problem is that when i insert a row in QListView the QTreeWidget does not update the size of the row with the new sizehint value, if i use updateGeometry() the sizehint in the delegate is not called, but if i collapse and axpand the item then the row gets resized. how can i force the QTreeWidget to resize the row according to the sizehint without having to collapse and expand the root item, Thanks



  • Ok, i have to call QTreeView::doItemsLayout()


Log in to reply