- QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
- if (aEditor) {
- QString aName = aEditor->text();
- QModelIndexList aIndexList = selectionModel()->selectedIndexes();
- XGUI_DataModel* aModel = dataModel();
- ObjectPtr aObj = aModel->object(aIndexList.first());
- SessionPtr aMgr = ModelAPI_Session::get();
- aMgr->startOperation("Rename");
+ static int aEntrance = 0;
+ if (aEntrance == 0) {
+ // We have to check number of enter and exit of this function because it can be called recursively by Qt
+ // in order to avoid double modifying of a data
+ aEntrance = 1;
+ QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
+ if (aEditor) {
+ QString aName = aEditor->text();
+ QModelIndexList aIndexList = selectionModel()->selectedIndexes();
+ XGUI_DataModel* aModel = dataModel();
+ ObjectPtr aObj = aModel->object(aIndexList.first());