I have QStandardItem::text() displayed using QTreeView thus:
QtPost_treeWidget.PNG

I would like the names of the items under a parent to be unique. In this example, this is the flow of events:
  • First I double click on 'Table3', it goes into edit mode.
  • Then I change the name to 'Table2' - not a unique name, and then click on 'Table1'.
  • In this case it pops up a message box, asking the user to fix the error (not a modal dialog! Just a simple message box).
  • When the user hits 'OK' in the message box, the slot keeps the view of the original item 'Table3' in edit mode.


But it's too late! My slot exits, and the slot that triggered itemChanged(...) signal now goes on to processing the clicked() action of `Table1'.

You know my conundrum now: how do I put an infinite loop in my slot that checks for uniqueness of the item names? Without popping up a modal dialog!! I understand how I can do it by populating a text box in a dialog and check it when the user clicks OK. Is there a better way to enforce uniqueness of the item names as they are being created through GUI.

Thanks!