Salome HOME
Define canBreakLink parameter
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Selection.cxx
index d0cd5c4dcc54cb765f55e29623e09432d8606095..d4b79054e6c4471eba61e351cedb3a3510685cb4 100644 (file)
@@ -140,6 +140,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
   else if ( p=="nbChildren")            val = QVariant( nbChildren( ind ) );
   else if ( p=="isContainer")           val = QVariant( isContainer( ind ) );
   else if ( p=="guiState")              val = QVariant( guiState() );
+  else if ( p=="canBreakLink")          val = QVariant( canBreakLink(ind) );
 
   if ( val.isValid() )
     return val;
@@ -605,6 +606,20 @@ bool SMESHGUI_Selection::hasGeomReference( int ind ) const
   return false;
 }
 
+//=======================================================================
+//function : canBreakLink
+//purpose  : returns true if selected object is a Shaper object and it can break link
+//=======================================================================
+
+bool SMESHGUI_Selection::canBreakLink( int ind ) const
+{
+  if ( ind >= 0 && ind < myTypes.count()) {
+    _PTR(SObject) so = SMESH::getStudy()->FindObjectID( entry( ind ).toUtf8().data() );
+    return true;
+  }
+  return false;
+}
+
 //=======================================================================
 //function : isEditableHyp
 //purpose  :