1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_SmoothingDlg.cxx
25 // Author : Michael ZORIN
29 #include "SMESHGUI_SmoothingDlg.h"
32 #include "SMESHGUI_SpinBox.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36 #include "SMESHGUI_IdValidator.h"
37 #include "SMESH_Actor.h"
38 #include "SMESH_TypeFilter.hxx"
39 #include "SMDS_Mesh.hxx"
41 #include "QAD_Application.h"
42 #include "QAD_Desktop.h"
43 #include "QAD_MessageBox.h"
44 #include "utilities.h"
47 #include <qapplication.h>
48 #include <qbuttongroup.h>
49 #include <qgroupbox.h>
51 #include <qlineedit.h>
52 #include <qpushbutton.h>
53 #include <qradiobutton.h>
54 #include <qcombobox.h>
55 #include <qcheckbox.h>
58 #include <qvalidator.h>
62 #include "SALOMEconfig.h"
63 #include CORBA_SERVER_HEADER(SMESH_Group)
67 //=================================================================================
68 // class : SMESHGUI_SmoothingDlg()
70 //=================================================================================
71 SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
72 bool modal, WFlags fl )
73 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
74 Qt::WDestructiveClose)
76 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_SMOOTHING")));
77 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
80 setName( "SMESHGUI_SmoothingDlg" );
82 setCaption( tr( "SMESH_SMOOTHING" ) );
83 setSizeGripEnabled( TRUE );
84 SMESHGUI_SmoothingDlgLayout = new QGridLayout( this );
85 SMESHGUI_SmoothingDlgLayout->setSpacing( 6 );
86 SMESHGUI_SmoothingDlgLayout->setMargin( 11 );
88 /***************************************************************/
89 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
90 GroupConstructors->setTitle( tr( "SMESH_SMOOTHING" ) );
91 GroupConstructors->setExclusive( TRUE );
92 GroupConstructors->setColumnLayout(0, Qt::Vertical );
93 GroupConstructors->layout()->setSpacing( 0 );
94 GroupConstructors->layout()->setMargin( 0 );
95 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
96 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
97 GroupConstructorsLayout->setSpacing( 6 );
98 GroupConstructorsLayout->setMargin( 11 );
99 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
100 Constructor1->setText( tr( "" ) );
101 Constructor1->setPixmap( image0 );
102 Constructor1->setChecked( TRUE );
103 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
104 Constructor1->setMinimumSize( QSize( 50, 0 ) );
105 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
106 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
107 GroupConstructorsLayout->addItem( spacer, 0, 1 );
108 SMESHGUI_SmoothingDlgLayout->addWidget( GroupConstructors, 0, 0 );
110 /***************************************************************/
111 GroupButtons = new QGroupBox( this, "GroupButtons" );
112 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
113 GroupButtons->setTitle( tr( "" ) );
114 GroupButtons->setColumnLayout(0, Qt::Vertical );
115 GroupButtons->layout()->setSpacing( 0 );
116 GroupButtons->layout()->setMargin( 0 );
117 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
118 GroupButtonsLayout->setAlignment( Qt::AlignTop );
119 GroupButtonsLayout->setSpacing( 6 );
120 GroupButtonsLayout->setMargin( 11 );
121 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
122 buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
123 buttonCancel->setAutoDefault( TRUE );
124 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
125 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
126 buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
127 buttonApply->setAutoDefault( TRUE );
128 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
129 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
130 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
131 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
132 buttonOk->setText( tr( "SMESH_BUT_OK" ) );
133 buttonOk->setAutoDefault( TRUE );
134 buttonOk->setDefault( TRUE );
135 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
136 SMESHGUI_SmoothingDlgLayout->addWidget( GroupButtons, 2, 0 );
138 /***************************************************************/
139 GroupArguments = new QGroupBox( this, "GroupArguments" );
140 GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
141 GroupArguments->setColumnLayout(0, Qt::Vertical );
142 GroupArguments->layout()->setSpacing( 0 );
143 GroupArguments->layout()->setMargin( 0 );
144 GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
145 GroupArgumentsLayout->setAlignment( Qt::AlignTop );
146 GroupArgumentsLayout->setSpacing( 6 );
147 GroupArgumentsLayout->setMargin( 11 );
149 // Controls for elements selection
150 TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
151 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
152 GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
154 SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
155 SelectElementsButton->setText( tr( "" ) );
156 SelectElementsButton->setPixmap( image1 );
157 SelectElementsButton->setToggleButton( FALSE );
158 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
160 LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
161 LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
162 GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
164 // Control for the whole mesh selection
165 CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
166 CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
167 GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
169 // Controls for nodes selection
170 TextLabelNodes = new QLabel( GroupArguments, "TextLabelNodes" );
171 TextLabelNodes->setText( tr( "FIXED_NODES_IDS" ) );
172 GroupArgumentsLayout->addWidget( TextLabelNodes, 2, 0 );
174 SelectNodesButton = new QPushButton( GroupArguments, "SelectNodesButton" );
175 SelectNodesButton->setText( tr( "" ) );
176 SelectNodesButton->setPixmap( image1 );
177 SelectNodesButton->setToggleButton( FALSE );
178 GroupArgumentsLayout->addWidget( SelectNodesButton, 2, 1 );
180 LineEditNodes = new QLineEdit( GroupArguments, "LineEditNodes" );
181 LineEditNodes->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
182 GroupArgumentsLayout->addWidget( LineEditNodes, 2, 2 );
184 // Controls for method selection
185 TextLabelMethod = new QLabel( GroupArguments, "TextLabelMethod" );
186 TextLabelMethod->setText( tr( "METHOD" ) );
187 GroupArgumentsLayout->addMultiCellWidget( TextLabelMethod, 3, 3, 0, 1 );
189 ComboBoxMethod = new QComboBox( GroupArguments, "ComboBoxMethod" );
190 GroupArgumentsLayout->addWidget( ComboBoxMethod, 3, 2 );
192 // Controls for iteration limit defining
193 TextLabelLimit = new QLabel( GroupArguments, "TextLabelLimit" );
194 TextLabelLimit->setText( tr( "ITERATION_LIMIT" ) );
195 GroupArgumentsLayout->addMultiCellWidget( TextLabelLimit, 4, 4, 0, 1 );
197 SpinBox_IterationLimit = new QSpinBox(GroupArguments, "SpinBox_IterationLimit");
198 GroupArgumentsLayout->addWidget( SpinBox_IterationLimit, 4, 2 );
200 // Controls for max. aspect ratio defining
201 TextLabelAspectRatio = new QLabel( GroupArguments, "TextLabelAspectRatio" );
202 TextLabelAspectRatio->setText( tr( "MAX_ASPECT_RATIO" ) );
203 GroupArgumentsLayout->addMultiCellWidget( TextLabelAspectRatio, 5, 5, 0, 1 );
205 SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_AspectRatio");
206 GroupArgumentsLayout->addWidget( SpinBox_AspectRatio, 5, 2 );
209 SMESHGUI_SmoothingDlgLayout->addWidget( GroupArguments, 1, 0 );
211 /* Initialisations */
212 ComboBoxMethod->insertItem(tr("LAPLACIAN"));
213 ComboBoxMethod->insertItem(tr("CENTROIDAL"));
215 QIntValidator* anIntValidator = new QIntValidator(SpinBox_IterationLimit);
216 SpinBox_IterationLimit->setValidator(anIntValidator);
217 SpinBox_IterationLimit->setRange( 1, 999999 );
218 SpinBox_AspectRatio->RangeStepAndValidator( 0.0, +999999.999, 0.1, 3 );
220 GroupArguments->show();
221 myConstructorId = 0 ;
222 Constructor1->setChecked( TRUE );
225 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
226 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
228 // Costruction of the logical filter
229 SMESH_ListOfFilter aListOfFilters;
230 Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
231 if ( !aMeshOrSubMeshFilter.IsNull() )
232 aListOfFilters.Append( aMeshOrSubMeshFilter );
233 Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
234 if ( !aSmeshGroupFilter.IsNull() )
235 aListOfFilters.Append( aSmeshGroupFilter );
237 myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
240 /* signals and slots connections */
241 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
242 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
243 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
244 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
246 connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
247 connect( SelectNodesButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
248 connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
249 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
250 /* to close dialog if study change */
251 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
252 connect( LineEditElements, SIGNAL( textChanged( const QString& )),
253 SLOT( onTextChange( const QString& )));
254 connect( LineEditNodes, SIGNAL( textChanged( const QString& )),
255 SLOT( onTextChange( const QString& )));
256 connect( CheckBoxMesh, SIGNAL( toggled( bool )),
257 SLOT( onSelectMesh( bool )));
259 /* Move widget on the botton right corner of main widget */
261 mySMESHGUI->DefineDlgPosition( this, x, y ) ;
263 this->show() ; /* displays Dialog */
266 //=================================================================================
267 // function : ~SMESHGUI_SmoothingDlg()
268 // purpose : Destroys the object and frees any allocated resources
269 //=================================================================================
270 SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
272 // no need to delete child widgets, Qt does it all for us
276 //=================================================================================
279 //=================================================================================
280 void SMESHGUI_SmoothingDlg::Init()
284 ComboBoxMethod->setCurrentItem(0);
286 SpinBox_IterationLimit->setValue(20);
287 SpinBox_AspectRatio->SetValue(1.1);
289 myEditCurrentArgument = LineEditElements;
290 LineEditElements->setFocus();
295 myMesh = SMESH::SMESH_Mesh::_nil();
297 CheckBoxMesh->setChecked(false);
298 onSelectMesh( false );
302 //=================================================================================
303 // function : ConstructorsClicked()
304 // purpose : Radio button management
305 //=================================================================================
306 void SMESHGUI_SmoothingDlg::ConstructorsClicked(int constructorId)
312 //=================================================================================
313 // function : ClickOnApply()
315 //=================================================================================
316 void SMESHGUI_SmoothingDlg::ClickOnApply()
318 if (mySMESHGUI->ActiveStudyLocked())
321 if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()))
323 QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
324 QStringList aListNodesId = QStringList::split( " ", LineEditNodes->text(), false);
326 SMESH::long_array_var anElementsId = new SMESH::long_array;
327 SMESH::long_array_var aNodesId = new SMESH::long_array;
329 anElementsId->length( aListElementsId.count() );
330 for ( int i = 0; i < aListElementsId.count(); i++ )
331 anElementsId[i] = aListElementsId[i].toInt();
335 aNodesId->length( aListNodesId.count() );
336 for ( int i = 0; i < aListNodesId.count(); i++ )
337 aNodesId[i] = aListNodesId[i].toInt();
340 anElementsId->length(0);
342 long anIterationLimit = (long)SpinBox_IterationLimit->value();
343 double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
345 SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
346 if (ComboBoxMethod->currentItem() > 0)
347 aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
349 bool aResult = false;
352 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
353 QApplication::setOverrideCursor(Qt::waitCursor);
354 aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod);
355 QApplication::restoreOverrideCursor();
363 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
364 mySelection->ClearIObjects();
366 mySelection->AddIObject( anIO, false );
373 //=================================================================================
374 // function : ClickOnOk()
376 //=================================================================================
377 void SMESHGUI_SmoothingDlg::ClickOnOk()
384 //=================================================================================
385 // function : ClickOnCancel()
387 //=================================================================================
388 void SMESHGUI_SmoothingDlg::ClickOnCancel()
390 mySelection->ClearFilters();
391 mySelection->ClearIObjects();
392 SMESH::SetPointRepresentation(false);
393 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
394 disconnect( mySelection, 0, this, 0 );
395 mySMESHGUI->ResetState() ;
399 //=======================================================================
400 //function : onTextChange
402 //=======================================================================
404 void SMESHGUI_SmoothingDlg::onTextChange(const QString& theNewText)
406 QLineEdit* send = (QLineEdit*)sender();
408 if ( myBusy ) return;
411 if (send == LineEditElements)
413 else if (send == LineEditNodes)
416 buttonOk->setEnabled( false );
417 buttonApply->setEnabled( false );
419 // hilight entered elements/nodes
420 SMDS_Mesh* aMesh = 0;
422 aMesh = myActor->GetObject()->GetMesh();
425 mySelection->ClearIObjects();
426 mySelection->AddIObject( myActor->getIO() );
428 QStringList aListId = QStringList::split( " ", theNewText, false);
430 if (send == LineEditElements) {
431 for ( int i = 0; i < aListId.count(); i++ ) {
432 const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
434 if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
435 mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
439 myElementsId = theNewText;
441 else if (send == LineEditNodes) {
442 for ( int i = 0; i < aListId.count(); i++ ) {
443 const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
445 if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
446 mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
453 if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()) ) {
454 buttonOk->setEnabled( true );
455 buttonApply->setEnabled( true );
461 //=================================================================================
462 // function : SelectionIntoArgument()
463 // purpose : Called when selection as changed or other case
464 //=================================================================================
465 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
467 if ( myBusy ) return;
471 QString aString = "";
474 if (myEditCurrentArgument == (QWidget*)LineEditElements)
476 LineEditElements->setText( aString );
478 buttonOk->setEnabled( false );
479 buttonApply->setEnabled( false );
483 if ( !GroupButtons->isEnabled() ) // inactive
488 int nbSel = mySelection->IObjectCount();
492 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
493 myMesh = SMESH::GetMeshByIO(IO);
494 if(myMesh->_is_nil())
496 myActor = SMESH::FindActorByObject(myMesh);
502 if (myEditCurrentArgument == LineEditElements)
506 if (CheckBoxMesh->isChecked())
508 SMESH::GetNameOfSelectedIObjects(mySelection, aString);
510 if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
513 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
517 for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
519 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
521 myElementsId += QString(" %1").arg(i);
526 else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
529 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
531 // get IDs from submesh
532 SMESH::long_array_var anElementsIds = new SMESH::long_array;
533 anElementsIds = aSubMesh->GetElementsId();
534 for ( int i = 0; i < anElementsIds->length(); i++ )
535 myElementsId += QString(" %1").arg(anElementsIds[i]);
536 aNbUnits = anElementsIds->length();
541 SMESH::SMESH_GroupBase_var aGroup
542 = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
543 if (aGroup->_is_nil())
546 // get IDs from smesh group
547 SMESH::long_array_var anElementsIds = new SMESH::long_array;
548 anElementsIds = aGroup->GetListOfID();
549 for ( int i = 0; i < anElementsIds->length(); i++ )
550 myElementsId += QString(" %1").arg(anElementsIds[i]);
551 aNbUnits = anElementsIds->length();
556 aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
557 myElementsId = aString;
560 else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor)
563 aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
570 myEditCurrentArgument->setText( aString );
574 if (myEditCurrentArgument == LineEditElements)
575 myNbOkElements = true;
576 else if (myEditCurrentArgument == LineEditNodes)
581 buttonOk->setEnabled( true );
582 buttonApply->setEnabled( true );
587 //=================================================================================
588 // function : SetEditCurrentArgument()
590 //=================================================================================
591 void SMESHGUI_SmoothingDlg::SetEditCurrentArgument()
593 QPushButton* send = (QPushButton*)sender();
595 switch (myConstructorId)
597 case 0: /* default constructor */
599 disconnect( mySelection, 0, this, 0 );
600 mySelection->ClearIObjects();
601 mySelection->ClearFilters();
603 if(send == SelectElementsButton) {
604 myEditCurrentArgument = LineEditElements;
605 SMESH::SetPointRepresentation(false);
606 if (CheckBoxMesh->isChecked())
608 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
609 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
612 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
614 else if (send == SelectNodesButton)
616 myEditCurrentArgument = LineEditNodes;
617 SMESH::SetPointRepresentation(true);
618 QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
621 myEditCurrentArgument->setFocus();
622 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
623 SelectionIntoArgument() ;
629 //=================================================================================
630 // function : DeactivateActiveDialog()
632 //=================================================================================
633 void SMESHGUI_SmoothingDlg::DeactivateActiveDialog()
635 if ( GroupConstructors->isEnabled() ) {
636 GroupConstructors->setEnabled(false) ;
637 GroupArguments->setEnabled(false) ;
638 GroupButtons->setEnabled(false) ;
639 mySMESHGUI->ResetState() ;
640 mySMESHGUI->SetActiveDialogBox(0) ;
645 //=================================================================================
646 // function : ActivateThisDialog()
648 //=================================================================================
649 void SMESHGUI_SmoothingDlg::ActivateThisDialog()
651 /* Emit a signal to deactivate the active dialog */
652 mySMESHGUI->EmitSignalDeactivateDialog() ;
653 GroupConstructors->setEnabled(true) ;
654 GroupArguments->setEnabled(true) ;
655 GroupButtons->setEnabled(true) ;
657 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
659 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
660 SelectionIntoArgument();
664 //=================================================================================
665 // function : enterEvent()
667 //=================================================================================
668 void SMESHGUI_SmoothingDlg::enterEvent(QEvent* e)
670 if ( GroupConstructors->isEnabled() )
672 ActivateThisDialog() ;
676 //=================================================================================
677 // function : closeEvent()
679 //=================================================================================
680 void SMESHGUI_SmoothingDlg::closeEvent( QCloseEvent* e )
682 /* same than click on cancel button */
683 this->ClickOnCancel() ;
687 //=======================================================================
688 //function : hideEvent
689 //purpose : caused by ESC key
690 //=======================================================================
692 void SMESHGUI_SmoothingDlg::hideEvent ( QHideEvent * e )
694 if ( !isMinimized() )
699 //=======================================================================
700 //function : onSelectMesh
702 //=======================================================================
703 void SMESHGUI_SmoothingDlg::onSelectMesh ( bool toSelectMesh )
706 TextLabelElements->setText( tr( "SMESH_NAME" ) );
708 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
710 if (myEditCurrentArgument != LineEditElements)
712 LineEditElements->clear();
716 mySelection->ClearFilters() ;
717 SMESH::SetPointRepresentation(false);
721 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
722 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
723 LineEditElements->setReadOnly(true);
727 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
728 LineEditElements->setReadOnly(false);
729 onTextChange(LineEditElements->text());
732 SelectionIntoArgument();