From: asl Date: Wed, 27 May 2015 13:39:17 +0000 (+0300) Subject: refs #534: not to show "New region" item on the empty or not-zone selection X-Git-Tag: v1.4.1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8710f1ab96864b12a3f902eb44b72b5d9dda90a1;p=modules%2Fhydro.git refs #534: not to show "New region" item on the empty or not-zone selection --- diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx index 4a553e04..57d868a1 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx @@ -322,5 +322,33 @@ void HYDROGUI_DataBrowser::setReadOnly( const bool theIsReadOnly ) void HYDROGUI_DataBrowser::createPopupMenu( QMenu* theMenu ) { theMenu->clear(); - theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) ); + DataObjectList aSelection = getSelected(); + bool isOnlyZones = aSelection.size() > 0; + foreach( SUIT_DataObject* anObj, aSelection ) + { + HYDROGUI_DataObject* aHydroObj = dynamic_cast( anObj ); + if( aHydroObj ) + { + Handle(HYDROData_Entity) aModelObj = aHydroObj->modelObject(); + if( !aModelObj.IsNull() ) + { + isOnlyZones = aModelObj->GetKind()==KIND_ZONE; + if( !isOnlyZones ) + break; + } + else + { + isOnlyZones = false; + break; + } + } + else + { + isOnlyZones = false; + break; + } + } + + if( isOnlyZones ) + theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) ); }