From: asv Date: Thu, 9 Jun 2005 12:33:07 +0000 (+0000) Subject: Bug with not full names of selected objects ("Box_" instead of "Box_1") in dialogs... X-Git-Tag: T3_0_0_a3~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f9080ed35172198c9beeae3f204ae3c3d7f600d7;p=modules%2Fgeom.git Bug with not full names of selected objects ("Box_" instead of "Box_1") in dialogs is fixed. GetName() method now returns QString. --- diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index f76cbb0d3..d2aedf727 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -219,8 +219,9 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, { GEOM::ListOfGO anObjs; ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); - if ( anObjs.length() == 1 ) + if ( anObjs.length() == 1 ) { theName = GetName( anObjs[ 0 ] ); + } else theName = QString( "%1_objects" ).arg( anObjs.length() ); @@ -946,7 +947,7 @@ bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& t // function : GetName() // purpose : Get name of object //======================================================================= -const char* GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) +QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) { SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); @@ -962,45 +963,15 @@ const char* GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) { _PTR(AttributeName) aNameAttr ( anAttr ); - return aNameAttr->Value().c_str(); + return QString( aNameAttr->Value().c_str() ); } } } - return ""; + return QString(""); } bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj ) { return !theObj->_is_nil() && theObj->IsShape(); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 018c5c259..e26eacab1 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -128,7 +128,7 @@ public : static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0); /* Gets name of object */ - static const char* GetName( GEOM::GEOM_Object_ptr ); + static QString GetName( GEOM::GEOM_Object_ptr ); static bool IsShape( GEOM::GEOM_Object_ptr theObj ); };