Here's the situation....

I have a QTreeView with a bunch of rows and columns. Let's say one of the columns has a check box (and each row has a check box for that column). If I were to do an ALT-CLICK on the check box I want all of the check boxes in the selected rows to change their values at once. Voila multi-select editing. (FYI: I'm only concerned with check boxes at this point)

The most obvious thing to try is to override the mouseClickEvent in QTreeView. However, the tree view displays the check box as a special kind of item delegate (QStyledItemDelegate). Meaning that the check box handles the mouse-click event all by itself. And the check box actually gets the mouse click before the QTreeView and passes the event up to its parent so the parent can change the selection.

Not only that but the check box modifies the model directly in its event handler. So before the QTreeView even gets the mouseReleaseEvent the model has already been updated.

The next thing to try would be to override the mouseReleaseEvent in the check box. It miiiight be possible to subclass that delegate to extend its functionality. But once again it does not know about the view or its selections. (It does know about keyboard modifiers and mouse buttons etc). We could of course pass the view along to the delegate (QStyledItemDelegate) but I believe that the delegates are static so you might have multiple views for a given delegate. So that might not even work.

I could be lame and try to put this functionality in a context menu that iterates over the selection but I'd rather it be builtin behavior based on keyboard modifiers and mouse clicks.

Has anyone dealt with this? Anyone have any advice?