Hi @Stefano_Fioravanzo, great question.
I agree that the stateChanged
signal is confusing, and I have actually been advocating that we remove it. That is fired only in a few specific circumstances, like when the trusted
or readonly
state changes. Normally, contentChanged
would be what you want except in this instance. This is because we internally implement changing a cell type by removing the old cell and inserting a new one with the same text content. So you can’t listen to change signals on the old one as it is not really the same cell.
I can’t think of a super clean way to do what you are describing, but a hack like the following could work:
- Listen to the
model.cells.changed
signal. - If a cell is deleted, cache the text content and type of the cell.
- If a cell is subsequently inserted, check to see if it is a new cell type with the same text content. That is your changed cell.
- If there is any other action, clear the cache.
Again, not super clean, but I think it could do what you describe. Hope this helps!