I have a
QStandardItemModel in which each item is checkable. I want different slots to be called when I click on the item's checkbox, on one hand, versus when I click on its text, on the other. My ultimate goal is to have text edits, and changes in checkbox state, go onto the
In my reimplementation of
clicked I want to treat checkbox clicks and text clicks differently. So far, I have found no way to differentiate these events in the documentation for
QCheckBox has a
toggled signal that I can use, I am not sure how to specifically listen for clicks on the text area.
I am trying to avoid having to set up coordinates manually and then listen for clicks in the different regions of the view of the item.
It doesn't seem this will be as simple as calling something like
itemChanged, because that only gives you the new state of the item, not the previous state. Based on previous questions, I believe you need some way to pack the previous state into the undo stack, so you know what to revert to. That's what I am aiming to do with
clicked, but there might be a better way.
This question piggybacks on the previous two in this series, in which I'm trying to figure out how to undo things in models:
- How to undo edit of QStandardItem in PySide/PyQt?
- How to undo an edit of a QListWidgetItem in PySide/PyQt?