Hi guys.

I have a QTreeView with only one column. The data is hierarchical so there are items that have children and others that do not. Each item is viewed with a subclass of QStyledItemDelegate. This subclass basically consists of a checkbox editable by the user, a number to the right of the checkbox to indicate the number of children the item has, one image to the right of the number and another image to the right of the other image.

The checkbox of each node draws with the QStyle::drawControl method and QStyle::CE_CheckBox as ControlElement in the paint method of my subclass. In the createEditor method of my subclass I create a QCheckBox to be able to change the value. The problem arises in this point. I want to change the value when the user clicks only on the square of the checkbox. At this time, the value changes if the user clicks on the text of the checkbox, on the icons, on the number the children, even the value changes when the user clicks to the left of the node, i mean, in the indentation(tab) of the son with respect to his father. This last behavior I do not understand, it is as if the delegate were the whole row, instead of where you start to paint each node.

Any ideas?