PAL10878 - "name" is absent when "Number of segment" is being created

This commit is contained in:
asl 2005-12-12 12:46:04 +00:00
parent 8a9307decf
commit fdc26f9a4d
2 changed files with 22 additions and 2 deletions

View File

@ -3,6 +3,9 @@
#include "StdMeshersGUI_DistrTable.h"
#include "StdMeshersGUI_DistrPreview.h"
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include <SalomeApp_Tools.h>
@ -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() );

View File

@ -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;