X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Tool.cxx;h=fee6e1105dc018dac99aff70dd9077297291c9bb;hb=84ec5b92ea05194a9d4d413b9bc896cf68d2e3ca;hp=c217725ab2e48741aef2f8397b07306ed75da90d;hpb=c773b2aacb4471d14d698e60df3ffa5889421a71;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index c217725a..fee6e110 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -68,7 +68,8 @@ void HYDROData_Tool::SetMustBeUpdatedImages( QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc, const QString& thePrefix, - const QStringList& theUsedNames ) + const QStringList& theUsedNames, + const bool theIsTryToUsePurePrefix ) { QStringList aNamesList( theUsedNames ); @@ -89,14 +90,18 @@ QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& th QString aName; - int anId = 1; - while( anId < 1000 ) - { - aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) ); + if ( theIsTryToUsePurePrefix && !aNamesList.contains( thePrefix ) ) { + aName = thePrefix; + } else { + int anId = 1; + while( anId < 1000 ) + { + aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) ); - // check that there are no other objects with the same name in the document - if ( !aNamesList.contains( aName ) ) - break; + // check that there are no other objects with the same name in the document + if ( !aNamesList.contains( aName ) ) + break; + } } return aName;