TextEdit in a ListView delegate
I'm trying to implement a list of text items. The text is editable, the delegate component contains a TextEdit item.
The behavior should be following:
- As soon as the text changes from the initial value a save buttonto store the cahnges appears (this is already implemented).
- When I click on another item, the change will not be saved and the TextEdit.text will return to the initial value.
I don't know how should I implement the second part. Do you have any idea?
Did you implement method setModelData() of the delegate? This is called in case the view ends the edit process in order to transfer the edit widgets contents to the model.
(oops ... it's about Qt Quick, dunno, if that applies here too.)
I solved the problem easily with a completely different approach then what I was trying first. I use Python (PySide) for the application logic and I didn't realize that I only need to call changed signal of a list item and the data will revert to the original values.
Sometimes it is better to take a day off and then look at the problem from a different side.