How can I make a (not all) tree item always expanded in a QTreeView? I cannot find a good way to do it.
You just need to set the itemsExpandable property to false by calling setItemsExpandable(false). This property holds whether the user can expand and collapse items interactively. Once the property is set to false, any items expanded by you will not be possible to collapse by the user.
You can try:
tree_item.setExpanded(true)
tree_item.setDisabled(true)
I have not tested it but according to the docs it should work.
http://qt-project.org/doc/qt-4.8/qtreewidgetitem.html#setDisabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With