From d9359acfaf1fa39e052d117c30af8a28e117b78d Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 25 Aug 2015 12:28:07 +0300 Subject: [PATCH] Do not change history in ObjectBrowser if an operation is opened --- src/XGUI/XGUI_DataModel.cpp | 10 +++++----- src/XGUI/XGUI_ObjectsBrowser.cpp | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 2f0672cfe..344b4bfc3 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -644,6 +644,9 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const aObj = (ModelAPI_Object*) theIndex.internalPointer(); } if (aObj) { + if (aObj->isDisabled()) + return Qt::ItemFlags(); + bool isCompositeSub = false; if (theIndex.column() == 1) { ObjectPtr aObjPtr = aObj->data()->owner(); @@ -664,12 +667,9 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const // An object which is sub-object of a composite object can not be accessible in column 1 if (isCompositeSub) return Qt::ItemFlags(); + } - aFlags |= Qt::ItemIsEditable; - if (!aObj->isDisabled()) - aFlags |= Qt::ItemIsEnabled; - } else - aFlags |= Qt::ItemIsEnabled; + aFlags |= Qt::ItemIsEnabled; return aFlags; } diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 4846e2237..9a28b3292 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -130,12 +130,15 @@ void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex) { if (theIndex.column() != 1) return; + SessionPtr aMgr = ModelAPI_Session::get(); + // When operation is opened then we can not change history + if (aMgr->isOperation()) + return; ModuleBase_IDocumentDataModel* aModel = dataModel(); if (aModel->flags(theIndex) == 0) return; ObjectPtr aObj = aModel->object(theIndex); - SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); QModelIndex aOldIndex = aModel->lastHistoryIndex(); -- 2.39.2