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

QTreeView with Tristate checkboxes



  • Hello gents,
    I have a silly question regarding the usage of tristate checkboxes within a QTreeView.

    According to Qt documentation :

    Qt::ItemIsAutoTristate : The item's state depends on the state of its children. This enables automatic management of the state of parent items in QTreeWidget (checked if all children are checked, unchecked if all children are unchecked, or partially checked if only some children are checked).
    

    I understand that the tristate propagation behavior automatically works with QTreeWidget... But does that mean that if I use a QTreeView with a custom model, I have to reimplement all of this behavior by myself ?

    Thanks & regards


  • Lifetime Qt Champion

    @JohnDoh said in QTreeView with Tristate checkboxes:

    I have to reimplement all of this behavior by myself ?

    Yes - the model has to do the work. QTreeWidget also uses an internal model which does it.



  • Thank you! I close the topic :)


Log in to reply