From: vsv Date: Fri, 20 Dec 2019 12:53:23 +0000 (+0300) Subject: Define canBreakLink parameter X-Git-Tag: V9_5_0a1~5^2~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b8ddb1330cad42ad5381912dd267d1e39182daae;p=modules%2Fsmesh.git Define canBreakLink parameter --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 4a612b59d..5a3747d0c 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4888,7 +4888,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( separator(), -1, -1 ); popupMgr()->insert( action( SMESHOp::OpBreakLink), -1, -1 ); - popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser'", QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser' and canBreakLink", QtxPopupMgr::VisibleRule ); connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ), this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) ); diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index d0cd5c4dc..d4b79054e 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -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 : diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 7ebf07a26..6ca2c0cb1 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -61,6 +61,7 @@ public: virtual bool hasGeomReference( int ) const; virtual bool isEditableHyp( int ) const; virtual bool isVisible( int ) const; + virtual bool canBreakLink(int) const; virtual bool isQuadratic( int ) const; virtual QString quadratic2DMode( int ) const;