QT4 - X11

I have a QTreeView set up to enable user editing of items. Very simple - double click an item's text and type the changes, <return> ends the edit and commits the change to the model - works a treat.

If an edit is in progress and the user saves the file without hitting return first (and thus not exiting the editor), the changes are not written to disk ( they're not lost - they're still visible in the editor).

I had thought that when the editor lost focus as the user hit the save button, it would end the editing session automatically, but no.

Any suggestions as to how to force the editor to close and commit changes before saving the file please?