BreakBad
6th September 2013, 19:54
Qt 4.7.3
PySide 1.1.0
My QTreeView has a QSortFilterProxyModel and in the flags I've added ItemIsUserCheckable and ItemIsTristate. When the tree displays, it displays correctly, some boxes are unchecked, some checked, and some partially checked.
Problem: When clicking through a checkbox's states, it will successfully go from partially checked, to checked and from checked to unchecked. However, when clicking an unchecked box, the setData method prints that is is trying to set a QtCore.Qt.Checked value instead of partially checked. Therefor I am unable to set an item back to a partially checked state. :confused:
What would prevent the click from sending a partiallychecked value in the signal?
Added after 1 13 minutes:
To answer my own question (again), I had to browser the API for QAbstractButton and found this in the nextCheckState method:
This virtual handler is called when a button is clicked. The default implementation calls setChecked(!isChecked()) if the button isCheckable(). It allows subclasses to implement intermediate button states.
So I merely have to implement the setData method to accommodate.
PySide 1.1.0
My QTreeView has a QSortFilterProxyModel and in the flags I've added ItemIsUserCheckable and ItemIsTristate. When the tree displays, it displays correctly, some boxes are unchecked, some checked, and some partially checked.
Problem: When clicking through a checkbox's states, it will successfully go from partially checked, to checked and from checked to unchecked. However, when clicking an unchecked box, the setData method prints that is is trying to set a QtCore.Qt.Checked value instead of partially checked. Therefor I am unable to set an item back to a partially checked state. :confused:
What would prevent the click from sending a partiallychecked value in the signal?
Added after 1 13 minutes:
To answer my own question (again), I had to browser the API for QAbstractButton and found this in the nextCheckState method:
This virtual handler is called when a button is clicked. The default implementation calls setChecked(!isChecked()) if the button isCheckable(). It allows subclasses to implement intermediate button states.
So I merely have to implement the setData method to accommodate.