]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL10878 - "name" is absent when "Number of segment" is being created
authorasl <asl@opencascade.com>
Mon, 12 Dec 2005 12:46:04 +0000 (12:46 +0000)
committerasl <asl@opencascade.com>
Mon, 12 Dec 2005 12:46:04 +0000 (12:46 +0000)
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h

index 9283a6c87a5e20bce7fb8d1e2aea3e8292c6c544..8916a619cba18fac41d527e41a426d97a345717a 100644 (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() );
index 5c5262cfabef5cbdf36dc2f60619e70d5a613ab9..26ca09918959aff98ed0e73aac2164dcb83d98aa 100644 (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;