From: asl Date: Mon, 12 Dec 2005 12:46:04 +0000 (+0000) Subject: PAL10878 - "name" is absent when "Number of segment" is being created X-Git-Tag: T_3_1_0pre~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fdc26f9a4dfcc8273367bbb7182896cf42812510;p=modules%2Fsmesh.git PAL10878 - "name" is absent when "Number of segment" is being created --- diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 9283a6c87..8916a619c 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -3,6 +3,9 @@ #include "StdMeshersGUI_DistrTable.h" #include "StdMeshersGUI_DistrPreview.h" +#include +#include + #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) #include @@ -77,6 +80,16 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() myGroupLayout->setColStretch( 1, 1 ); int row = 0; + // 0) name + myName = 0; + if( isCreation() ) + { + myName = new QLineEdit( GroupC1 ); + myGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 ); + myGroupLayout->addWidget( myName, row, 1 ); + row++; + } + // 1) number of segments myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 ); myNbSeg = new QtxIntSpinBox( GroupC1 ); @@ -153,6 +166,8 @@ void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const NbSegmentsHypothesisData data; readParamsFromHypo( data ); + if( myName ) + myName->setText( data.myName ); myNbSeg->setValue( data.myNbSeg ); myDistr->setCurrentItem( data.myDistrType ); myScale->setValue( data.myScale ); @@ -173,6 +188,9 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo( NbSegmentsHypothesisDa StdMeshers::StdMeshers_NumberOfSegments_var h = StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() ); + HypothesisData* data = SMESH::GetHypothesisData( hypType() ); + h_data.myName = isCreation() && data ? data->Label : QString(); + h_data.myNbSeg = (int) h->GetNumberOfSegments(); int distr = (int) h->GetDistrType(); h_data.myDistrType = distr; @@ -206,6 +224,7 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe bool ok = true; try { + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() ); h->SetNumberOfSegments( h_data.myNbSeg ); int distr = h_data.myDistrType; h->SetDistrType( distr ); @@ -235,6 +254,7 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesisData& h_data ) const { + h_data.myName = myName ? myName->text() : QString(); h_data.myNbSeg = myNbSeg->value(); h_data.myDistrType = myDistr->currentItem(); h_data.myConv = myConv->id( myConv->selected() ); diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index 5c5262cfa..26ca09918 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -21,7 +21,7 @@ typedef struct int myNbSeg, myDistrType, myConv; double myScale; SMESH::double_array myTable; - QString myExpr; + QString myName, myExpr; } NbSegmentsHypothesisData; @@ -54,7 +54,7 @@ private: SMESHGUI_SpinBox* myScale; StdMeshersGUI_DistrTableFrame* myTable; StdMeshersGUI_DistrPreview* myPreview; - QLineEdit* myExpr; + QLineEdit *myName, *myExpr; QButtonGroup* myConv; QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo; QGridLayout* myGroupLayout;