I am having a hard time correctly editing a QTreeWidgetItem when setting the item to edit mode. What is the correct way to do this. I would like to make it editable and when the user enters text and presses enter then the item changes its name. If the user presses the escape key then all changes are ignored and the name goes back to the original name. I appreciate any help.