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>
63 //=================================================================================
64 // class : SMESHGUI_SmoothingDlg()
66 //=================================================================================
67 SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel,
68 bool modal, WFlags fl )
69 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu |
70 Qt::WDestructiveClose)
72 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_SMOOTHING")));
73 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
76 setName( "SMESHGUI_SmoothingDlg" );
78 setCaption( tr( "SMESH_SMOOTHING" ) );
79 setSizeGripEnabled( TRUE );
80 SMESHGUI_SmoothingDlgLayout = new QGridLayout( this );
81 SMESHGUI_SmoothingDlgLayout->setSpacing( 6 );
82 SMESHGUI_SmoothingDlgLayout->setMargin( 11 );
84 /***************************************************************/
85 GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
86 GroupConstructors->setTitle( tr( "SMESH_SMOOTHING" ) );
87 GroupConstructors->setExclusive( TRUE );
88 GroupConstructors->setColumnLayout(0, Qt::Vertical );
89 GroupConstructors->layout()->setSpacing( 0 );
90 GroupConstructors->layout()->setMargin( 0 );
91 GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
92 GroupConstructorsLayout->setAlignment( Qt::AlignTop );
93 GroupConstructorsLayout->setSpacing( 6 );
94 GroupConstructorsLayout->setMargin( 11 );
95 Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
96 Constructor1->setText( tr( "" ) );
97 Constructor1->setPixmap( image0 );
98 Constructor1->setChecked( TRUE );
99 Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
100 Constructor1->setMinimumSize( QSize( 50, 0 ) );
101 GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
102 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
103 GroupConstructorsLayout->addItem( spacer, 0, 1 );
104 SMESHGUI_SmoothingDlgLayout->addWidget( GroupConstructors, 0, 0 );
106 /***************************************************************/
107 GroupButtons = new QGroupBox( this, "GroupButtons" );
108 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
109 GroupButtons->setTitle( tr( "" ) );
110 GroupButtons->setColumnLayout(0, Qt::Vertical );
111 GroupButtons->layout()->setSpacing( 0 );
112 GroupButtons->layout()->setMargin( 0 );
113 GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
114 GroupButtonsLayout->setAlignment( Qt::AlignTop );
115 GroupButtonsLayout->setSpacing( 6 );
116 GroupButtonsLayout->setMargin( 11 );
117 buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
118 buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
119 buttonCancel->setAutoDefault( TRUE );
120 GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
121 buttonApply = new QPushButton( GroupButtons, "buttonApply" );
122 buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
123 buttonApply->setAutoDefault( TRUE );
124 GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
125 QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
126 GroupButtonsLayout->addItem( spacer_9, 0, 2 );
127 buttonOk = new QPushButton( GroupButtons, "buttonOk" );
128 buttonOk->setText( tr( "SMESH_BUT_OK" ) );
129 buttonOk->setAutoDefault( TRUE );
130 buttonOk->setDefault( TRUE );
131 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
132 SMESHGUI_SmoothingDlgLayout->addWidget( GroupButtons, 2, 0 );
134 /***************************************************************/
135 GroupArguments = new QGroupBox( this, "GroupArguments" );
136 GroupArguments->setTitle( tr( "SMESH_ARGUMENTS" ) );
137 GroupArguments->setColumnLayout(0, Qt::Vertical );
138 GroupArguments->layout()->setSpacing( 0 );
139 GroupArguments->layout()->setMargin( 0 );
140 GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
141 GroupArgumentsLayout->setAlignment( Qt::AlignTop );
142 GroupArgumentsLayout->setSpacing( 6 );
143 GroupArgumentsLayout->setMargin( 11 );
145 // Controls for elements selection
146 TextLabelElements = new QLabel( GroupArguments, "TextLabelElements" );
147 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
148 GroupArgumentsLayout->addWidget( TextLabelElements, 0, 0 );
150 SelectElementsButton = new QPushButton( GroupArguments, "SelectElementsButton" );
151 SelectElementsButton->setText( tr( "" ) );
152 SelectElementsButton->setPixmap( image1 );
153 SelectElementsButton->setToggleButton( FALSE );
154 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
156 LineEditElements = new QLineEdit( GroupArguments, "LineEditElements" );
157 LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
158 GroupArgumentsLayout->addWidget( LineEditElements, 0, 2 );
160 // Control for the whole mesh selection
161 CheckBoxMesh = new QCheckBox( GroupArguments, "CheckBoxMesh" );
162 CheckBoxMesh->setText( tr( "SMESH_SELECT_WHOLE_MESH" ) );
163 GroupArgumentsLayout->addMultiCellWidget( CheckBoxMesh, 1, 1, 0, 2 );
165 // Controls for nodes selection
166 TextLabelNodes = new QLabel( GroupArguments, "TextLabelNodes" );
167 TextLabelNodes->setText( tr( "FIXED_NODES_IDS" ) );
168 GroupArgumentsLayout->addWidget( TextLabelNodes, 2, 0 );
170 SelectNodesButton = new QPushButton( GroupArguments, "SelectNodesButton" );
171 SelectNodesButton->setText( tr( "" ) );
172 SelectNodesButton->setPixmap( image1 );
173 SelectNodesButton->setToggleButton( FALSE );
174 GroupArgumentsLayout->addWidget( SelectNodesButton, 2, 1 );
176 LineEditNodes = new QLineEdit( GroupArguments, "LineEditNodes" );
177 LineEditNodes->setValidator( new SMESHGUI_IdValidator( this, "validator" ));
178 GroupArgumentsLayout->addWidget( LineEditNodes, 2, 2 );
180 // Controls for method selection
181 TextLabelMethod = new QLabel( GroupArguments, "TextLabelMethod" );
182 TextLabelMethod->setText( tr( "METHOD" ) );
183 GroupArgumentsLayout->addMultiCellWidget( TextLabelMethod, 3, 3, 0, 1 );
185 ComboBoxMethod = new QComboBox( GroupArguments, "ComboBoxMethod" );
186 GroupArgumentsLayout->addWidget( ComboBoxMethod, 3, 2 );
188 // Controls for iteration limit defining
189 TextLabelLimit = new QLabel( GroupArguments, "TextLabelLimit" );
190 TextLabelLimit->setText( tr( "ITERATION_LIMIT" ) );
191 GroupArgumentsLayout->addMultiCellWidget( TextLabelLimit, 4, 4, 0, 1 );
193 SpinBox_IterationLimit = new QSpinBox(GroupArguments, "SpinBox_IterationLimit");
194 GroupArgumentsLayout->addWidget( SpinBox_IterationLimit, 4, 2 );
196 // Controls for max. aspect ratio defining
197 TextLabelAspectRatio = new QLabel( GroupArguments, "TextLabelAspectRatio" );
198 TextLabelAspectRatio->setText( tr( "MAX_ASPECT_RATIO" ) );
199 GroupArgumentsLayout->addMultiCellWidget( TextLabelAspectRatio, 5, 5, 0, 1 );
201 SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_AspectRatio");
202 GroupArgumentsLayout->addWidget( SpinBox_AspectRatio, 5, 2 );
205 SMESHGUI_SmoothingDlgLayout->addWidget( GroupArguments, 1, 0 );
207 /* Initialisations */
208 ComboBoxMethod->insertItem(tr("LAPLACIAN"));
209 ComboBoxMethod->insertItem(tr("CENTROIDAL"));
211 QIntValidator* anIntValidator = new QIntValidator(SpinBox_IterationLimit);
212 SpinBox_IterationLimit->setValidator(anIntValidator);
213 SpinBox_IterationLimit->setRange( 1, 999999 );
214 SpinBox_AspectRatio->RangeStepAndValidator( 0.0, +999999.999, 0.1, 3 );
216 GroupArguments->show();
217 myConstructorId = 0 ;
218 Constructor1->setChecked( TRUE );
221 mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
222 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
224 // Costruction of the logical filter
225 SMESH_ListOfFilter aListOfFilters;
226 Handle(SMESH_TypeFilter) aMeshOrSubMeshFilter = new SMESH_TypeFilter( MESHorSUBMESH );
227 if ( !aMeshOrSubMeshFilter.IsNull() )
228 aListOfFilters.Append( aMeshOrSubMeshFilter );
229 Handle(SMESH_TypeFilter) aSmeshGroupFilter = new SMESH_TypeFilter( GROUP );
230 if ( !aSmeshGroupFilter.IsNull() )
231 aListOfFilters.Append( aSmeshGroupFilter );
233 myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter( aListOfFilters, SMESH_LogicalFilter::LO_OR );
236 /* signals and slots connections */
237 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
238 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
239 connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
240 connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
242 connect( SelectElementsButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
243 connect( SelectNodesButton, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
244 connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
245 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
246 /* to close dialog if study change */
247 connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
248 connect( LineEditElements, SIGNAL( textChanged( const QString& )),
249 SLOT( onTextChange( const QString& )));
250 connect( LineEditNodes, SIGNAL( textChanged( const QString& )),
251 SLOT( onTextChange( const QString& )));
252 connect( CheckBoxMesh, SIGNAL( toggled( bool )),
253 SLOT( onSelectMesh( bool )));
255 /* Move widget on the botton right corner of main widget */
257 mySMESHGUI->DefineDlgPosition( this, x, y ) ;
259 this->show() ; /* displays Dialog */
262 //=================================================================================
263 // function : ~SMESHGUI_SmoothingDlg()
264 // purpose : Destroys the object and frees any allocated resources
265 //=================================================================================
266 SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
268 // no need to delete child widgets, Qt does it all for us
272 //=================================================================================
275 //=================================================================================
276 void SMESHGUI_SmoothingDlg::Init()
280 ComboBoxMethod->setCurrentItem(0);
282 SpinBox_IterationLimit->setValue(20);
283 SpinBox_AspectRatio->SetValue(1.1);
285 myEditCurrentArgument = LineEditElements;
286 LineEditElements->setFocus();
291 myMesh = SMESH::SMESH_Mesh::_nil();
293 CheckBoxMesh->setChecked(false);
294 onSelectMesh( false );
298 //=================================================================================
299 // function : ConstructorsClicked()
300 // purpose : Radio button management
301 //=================================================================================
302 void SMESHGUI_SmoothingDlg::ConstructorsClicked(int constructorId)
308 //=================================================================================
309 // function : ClickOnApply()
311 //=================================================================================
312 void SMESHGUI_SmoothingDlg::ClickOnApply()
314 if (mySMESHGUI->ActiveStudyLocked())
317 if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()))
319 QStringList aListElementsId = QStringList::split( " ", myElementsId, false);
320 QStringList aListNodesId = QStringList::split( " ", LineEditNodes->text(), false);
322 SMESH::long_array_var anElementsId = new SMESH::long_array;
323 SMESH::long_array_var aNodesId = new SMESH::long_array;
325 anElementsId->length( aListElementsId.count() );
326 for ( int i = 0; i < aListElementsId.count(); i++ )
327 anElementsId[i] = aListElementsId[i].toInt();
331 aNodesId->length( aListNodesId.count() );
332 for ( int i = 0; i < aListNodesId.count(); i++ )
333 aNodesId[i] = aListNodesId[i].toInt();
336 anElementsId->length(0);
338 long anIterationLimit = (long)SpinBox_IterationLimit->value();
339 double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
341 SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
342 if (ComboBoxMethod->currentItem() > 0)
343 aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
345 bool aResult = false;
348 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
349 QApplication::setOverrideCursor(Qt::waitCursor);
350 aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod);
351 QApplication::restoreOverrideCursor();
359 Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
360 mySelection->ClearIObjects();
362 mySelection->AddIObject( anIO, false );
369 //=================================================================================
370 // function : ClickOnOk()
372 //=================================================================================
373 void SMESHGUI_SmoothingDlg::ClickOnOk()
380 //=================================================================================
381 // function : ClickOnCancel()
383 //=================================================================================
384 void SMESHGUI_SmoothingDlg::ClickOnCancel()
386 mySelection->ClearFilters();
387 mySelection->ClearIObjects();
388 SMESH::SetPointRepresentation(false);
389 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
390 disconnect( mySelection, 0, this, 0 );
391 mySMESHGUI->ResetState() ;
395 //=======================================================================
396 //function : onTextChange
398 //=======================================================================
400 void SMESHGUI_SmoothingDlg::onTextChange(const QString& theNewText)
402 QLineEdit* send = (QLineEdit*)sender();
404 if ( myBusy ) return;
407 if (send == LineEditElements)
409 else if (send == LineEditNodes)
412 buttonOk->setEnabled( false );
413 buttonApply->setEnabled( false );
415 // hilight entered elements/nodes
416 SMDS_Mesh* aMesh = 0;
418 aMesh = myActor->GetObject()->GetMesh();
421 mySelection->ClearIObjects();
422 mySelection->AddIObject( myActor->getIO() );
424 QStringList aListId = QStringList::split( " ", theNewText, false);
426 if (send == LineEditElements) {
427 for ( int i = 0; i < aListId.count(); i++ ) {
428 const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
430 if ( !mySelection->IsIndexSelected( myActor->getIO(), e->GetID() ))
431 mySelection->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);
435 myElementsId = theNewText;
437 else if (send == LineEditNodes) {
438 for ( int i = 0; i < aListId.count(); i++ ) {
439 const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
441 if ( !mySelection->IsIndexSelected( myActor->getIO(), n->GetID() ))
442 mySelection->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);
449 if ( myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty()) ) {
450 buttonOk->setEnabled( true );
451 buttonApply->setEnabled( true );
457 //=================================================================================
458 // function : SelectionIntoArgument()
459 // purpose : Called when selection as changed or other case
460 //=================================================================================
461 void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
463 if ( myBusy ) return;
467 QString aString = "";
470 if (myEditCurrentArgument == (QWidget*)LineEditElements)
472 LineEditElements->setText( aString );
474 buttonOk->setEnabled( false );
475 buttonApply->setEnabled( false );
479 if ( !GroupButtons->isEnabled() ) // inactive
484 int nbSel = mySelection->IObjectCount();
488 Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
489 myMesh = SMESH::GetMeshByIO(IO);
490 if(myMesh->_is_nil())
492 myActor = SMESH::FindActorByObject(myMesh);
498 if (myEditCurrentArgument == LineEditElements)
502 if (CheckBoxMesh->isChecked())
504 SMESH::GetNameOfSelectedIObjects(mySelection, aString);
506 if(!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) //MESH
509 SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
513 for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ )
515 const SMDS_MeshElement * e = aSMDSMesh->FindElement( i );
517 myElementsId += QString(" %1").arg(i);
522 else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) //SUBMESH
525 SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO) ;
527 // get IDs from submesh
528 SMESH::long_array_var anElementsIds = new SMESH::long_array;
529 anElementsIds = aSubMesh->GetElementsId();
530 for ( int i = 0; i < anElementsIds->length(); i++ )
531 myElementsId += QString(" %1").arg(anElementsIds[i]);
532 aNbUnits = anElementsIds->length();
537 SMESH::SMESH_GroupBase_var aGroup
538 = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
539 if (aGroup->_is_nil())
542 // get IDs from smesh group
543 SMESH::long_array_var anElementsIds = new SMESH::long_array;
544 anElementsIds = aGroup->GetListOfID();
545 for ( int i = 0; i < anElementsIds->length(); i++ )
546 myElementsId += QString(" %1").arg(anElementsIds[i]);
547 aNbUnits = anElementsIds->length();
552 aNbUnits = SMESH::GetNameOfSelectedElements(mySelection, aString) ;
553 myElementsId = aString;
556 else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor)
559 aNbUnits = SMESH::GetNameOfSelectedNodes(mySelection, aString) ;
566 myEditCurrentArgument->setText( aString );
570 if (myEditCurrentArgument == LineEditElements)
571 myNbOkElements = true;
572 else if (myEditCurrentArgument == LineEditNodes)
577 buttonOk->setEnabled( true );
578 buttonApply->setEnabled( true );
583 //=================================================================================
584 // function : SetEditCurrentArgument()
586 //=================================================================================
587 void SMESHGUI_SmoothingDlg::SetEditCurrentArgument()
589 QPushButton* send = (QPushButton*)sender();
591 switch (myConstructorId)
593 case 0: /* default constructor */
595 disconnect( mySelection, 0, this, 0 );
596 mySelection->ClearIObjects();
597 mySelection->ClearFilters();
599 if(send == SelectElementsButton) {
600 myEditCurrentArgument = LineEditElements;
601 SMESH::SetPointRepresentation(false);
602 if (CheckBoxMesh->isChecked())
604 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
605 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
608 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
610 else if (send == SelectNodesButton)
612 myEditCurrentArgument = LineEditNodes;
613 SMESH::SetPointRepresentation(true);
614 QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
617 myEditCurrentArgument->setFocus();
618 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
619 SelectionIntoArgument() ;
625 //=================================================================================
626 // function : DeactivateActiveDialog()
628 //=================================================================================
629 void SMESHGUI_SmoothingDlg::DeactivateActiveDialog()
631 if ( GroupConstructors->isEnabled() ) {
632 GroupConstructors->setEnabled(false) ;
633 GroupArguments->setEnabled(false) ;
634 GroupButtons->setEnabled(false) ;
635 mySMESHGUI->ResetState() ;
636 mySMESHGUI->SetActiveDialogBox(0) ;
641 //=================================================================================
642 // function : ActivateThisDialog()
644 //=================================================================================
645 void SMESHGUI_SmoothingDlg::ActivateThisDialog()
647 /* Emit a signal to deactivate the active dialog */
648 mySMESHGUI->EmitSignalDeactivateDialog() ;
649 GroupConstructors->setEnabled(true) ;
650 GroupArguments->setEnabled(true) ;
651 GroupButtons->setEnabled(true) ;
653 mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
655 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
656 SelectionIntoArgument();
660 //=================================================================================
661 // function : enterEvent()
663 //=================================================================================
664 void SMESHGUI_SmoothingDlg::enterEvent(QEvent* e)
666 if ( GroupConstructors->isEnabled() )
668 ActivateThisDialog() ;
672 //=================================================================================
673 // function : closeEvent()
675 //=================================================================================
676 void SMESHGUI_SmoothingDlg::closeEvent( QCloseEvent* e )
678 /* same than click on cancel button */
679 this->ClickOnCancel() ;
683 //=======================================================================
684 //function : hideEvent
685 //purpose : caused by ESC key
686 //=======================================================================
688 void SMESHGUI_SmoothingDlg::hideEvent ( QHideEvent * e )
690 if ( !isMinimized() )
695 //=======================================================================
696 //function : onSelectMesh
698 //=======================================================================
699 void SMESHGUI_SmoothingDlg::onSelectMesh ( bool toSelectMesh )
702 TextLabelElements->setText( tr( "SMESH_NAME" ) );
704 TextLabelElements->setText( tr( "SMESH_ID_ELEMENTS" ) );
706 if (myEditCurrentArgument != LineEditElements)
708 LineEditElements->clear();
712 mySelection->ClearFilters() ;
713 SMESH::SetPointRepresentation(false);
717 QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
718 mySelection->AddFilter(myMeshOrSubMeshOrGroupFilter);
719 LineEditElements->setReadOnly(true);
723 QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
724 LineEditElements->setReadOnly(false);
725 onTextChange(LineEditElements->text());
728 SelectionIntoArgument();