I have a QTreeView populated by a QAbstractItemModel subclass, allowing leaf nodes to be checked by the user. If a proper subset of the descendant leaf nodes of a non-leaf node are checked, then that node is partially checked (Qt::CheckStateRole is Qt::PartiallyChecked).
Currently if the user clicks on a partially checked node then the check state changes to Qt::Checked; I want it to clear the node instead (Qt::Unchecked). Is there a way to customise this behaviour? To control this with a QCheckBox I would override QAbstractButton::nextCheckState(), but I can't find anything similar for QTreeView.