From 81fe870d8beb5e1518b24f692e529427b0a16c57 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 24 Aug 2015 18:45:58 +0300 Subject: [PATCH] An object which is sub-object of a composite object can not be accessible in column 1 --- src/XGUI/XGUI_DataModel.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 1d422355b..13653e5f3 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -641,8 +641,28 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex& theIndex) const aObj = (ModelAPI_Object*) theIndex.internalPointer(); } if (aObj) { + bool isCompositeSub = false; + if (theIndex.column() == 1) { + ObjectPtr aObjPtr = aObj->data()->owner(); + FeaturePtr aFeature = std::dynamic_pointer_cast(aObjPtr); + if (aFeature.get()) { + CompositeFeaturePtr aCompFea = ModelAPI_Tools::compositeOwner(aFeature); + if (aCompFea.get()) + isCompositeSub = true; + } else { + ResultPtr aResult = std::dynamic_pointer_cast(aObjPtr); + if (aResult.get()) { + ResultCompSolidPtr aCompRes = ModelAPI_Tools::compSolidOwner(aResult); + if (aCompRes.get()) + isCompositeSub = true; + } + } + } + // 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 -- 2.39.2