Bug with not full names of selected objects ("Box_" instead of "Box_1") in dialogs is fixed. GetName() method now returns QString.

This commit is contained in:
asv 2005-06-09 12:33:07 +00:00
parent 46b338c045
commit f9080ed351
2 changed files with 6 additions and 35 deletions

View File

@ -219,8 +219,9 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList,
{ {
GEOM::ListOfGO anObjs; GEOM::ListOfGO anObjs;
ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly );
if ( anObjs.length() == 1 ) if ( anObjs.length() == 1 ) {
theName = GetName( anObjs[ 0 ] ); theName = GetName( anObjs[ 0 ] );
}
else else
theName = QString( "%1_objects" ).arg( anObjs.length() ); 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() // function : GetName()
// purpose : Get name of object // 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<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
@ -962,45 +963,15 @@ const char* GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") )
{ {
_PTR(AttributeName) aNameAttr ( anAttr ); _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 ) bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj )
{ {
return !theObj->_is_nil() && theObj->IsShape(); return !theObj->_is_nil() && theObj->IsShape();
} }

View File

@ -128,7 +128,7 @@ public :
static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0); static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0);
/* Gets name of object */ /* 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 ); static bool IsShape( GEOM::GEOM_Object_ptr theObj );
}; };