Salome HOME
Validator for partition
[modules/shaper.git] / src / PartSet / PartSet_PartDataModel.cpp
index d1a48fdf57b2726987491989e42f78b4582f57ee..fff14f9d4b0ae97eae84c6443eff4f5511391caa 100644 (file)
@@ -140,12 +140,19 @@ QVariant PartSet_PartDataModel::data(const QModelIndex& theIndex, int theRole) c
         case ConstructObject:
         case GroupObject:
         case BodiesObject: {
-          std::string aGroup = theIndex.internalId() == ConstructObject ?
-            ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group();
-          ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row());
-          if (anObject && anObject->data() && 
-              anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
-            return QIcon(":pictures/constr_object_modified.png");
+          std::string aGroup;
+          if (theIndex.internalId() == ConstructObject)
+            aGroup = ModelAPI_ResultConstruction::group();
+          else if (theIndex.internalId() == BodiesObject)
+            aGroup = ModelAPI_ResultBody::group();
+          else if (theIndex.internalId() == GroupObject)
+            aGroup = ModelAPI_ResultGroup::group();
+          if (aGroup.length() > 0) {
+            ObjectPtr anObject = aPartDoc->object(aGroup, theIndex.row());
+            if (anObject && anObject->data() && 
+                anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
+              return QIcon(":pictures/constr_object_modified.png");
+            }
           }
           return QIcon(":pictures/constr_object.png");
         }
@@ -424,10 +431,15 @@ QModelIndex PartSet_PartDataModel::lastHistoryItem() const
 
 Qt::ItemFlags PartSet_PartDataModel::flags(const QModelIndex& theIndex) const
 {
+  // Disable sub-features at column 1
+  if ((theIndex.column() == 1)  && (theIndex.internalId() >= 0))
+    return 0;
+
   Qt::ItemFlags aFlags = Qt::ItemIsSelectable;
   if (object(theIndex)) {
     aFlags |= Qt::ItemIsEditable;
   }
+
   if (theIndex.internalId() == HistoryObject) {
     if (theIndex.row() <= lastHistoryRow() || (theIndex.column() == 1))
       aFlags |= Qt::ItemIsEnabled;