Salome HOME
Integration of PAL/SALOME V2.1.0c from OCC
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddSubMeshDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESHGUI_AddSubMeshDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_AddSubMeshDlg.h"
30
31 #include "SMESHGUI.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_GEOMGenUtils.h"
34 #include "SMESHGUI_HypothesesUtils.h"
35
36 #include "QAD_Application.h"
37 #include "QAD_Desktop.h"
38 #include "QAD_MessageBox.h"
39 #include "QAD_WaitCursor.h"
40 #include "QAD_Operation.h"
41
42 #include "SALOME_ListIteratorOfListIO.hxx"
43 #include "SALOMEGUI_QtCatchCorbaException.hxx"
44
45 #include "utilities.h"
46
47 // QT Includes
48 #include <qgroupbox.h>
49 #include <qlabel.h>
50 #include <qlineedit.h>
51 #include <qpushbutton.h>
52 #include <qlayout.h>
53 #include <qpixmap.h>
54
55 using namespace std;
56
57 namespace SMESH{
58   SMESH::SMESH_subMesh_var AddSubMesh(SMESH::SMESH_Mesh_ptr theMesh, 
59                                       GEOM::GEOM_Object_ptr theShapeObject, 
60                                       const char* theMeshName )
61   {
62     SMESH::SMESH_subMesh_var aSubMesh;
63     try {
64       if ( !theMesh->_is_nil() && !theShapeObject->_is_nil() )
65         aSubMesh = theMesh->GetSubMesh( theShapeObject, theMeshName );
66     }
67     catch( const SALOME::SALOME_Exception& S_ex ) {
68       QtCatchCorbaException( S_ex );
69     }
70     return aSubMesh._retn();
71   }
72 }
73
74 //=================================================================================
75 // class    : SMESHGUI_AddSubMeshDlg()
76 // purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the 
77 //            name 'name' and widget flags set to 'f'.
78 //            The dialog will by default be modeless, unless you set 'modal' to
79 //            TRUE to construct a modal dialog.
80 //=================================================================================
81 SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
82     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
83 {
84     QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
85     if ( !name )
86         setName( "SMESHGUI_AddSubMeshDlg" );
87     setCaption( tr( "SMESH_ADD_SUBMESH"  ) );
88     setSizeGripEnabled( TRUE );
89     QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); 
90     SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
91     SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
92     
93     /***************************************************************/
94     GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
95     GroupC1->setColumnLayout(0, Qt::Vertical );
96     GroupC1->layout()->setSpacing( 0 );
97     GroupC1->layout()->setMargin( 0 );
98     QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
99     GroupC1Layout->setAlignment( Qt::AlignTop );
100     GroupC1Layout->setSpacing( 6 );
101     GroupC1Layout->setMargin( 11 );
102
103     TextLabel_NameMesh = new QLabel(  tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
104     GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
105     LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
106     GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
107
108     TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESH" ), GroupC1, "TextLabelC1A1" );
109     GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
110     SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
111     SelectButtonC1A1->setPixmap( image0 );
112     SelectButtonC1A1->setToggleButton( FALSE );
113     GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
114     LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
115     LineEditC1A1->setReadOnly( true );
116     GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
117
118     TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
119     GroupC1Layout->addWidget( TextLabelC1A2, 2, 0 );
120     SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
121     SelectButtonC1A2->setPixmap( image0 );
122     SelectButtonC1A2->setToggleButton( FALSE );
123     GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
124     LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
125     LineEditC1A2->setReadOnly( true );
126     GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
127
128     TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
129     GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
130     SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
131     SelectButtonC1A1Hyp->setPixmap( image0 );
132     GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
133     LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
134     LineEditC1A1Hyp->setReadOnly( true );
135     GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
136
137     TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
138     GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
139     SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
140     SelectButtonC1A1Algo->setPixmap( image0 );
141     GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
142     LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
143     LineEditC1A1Algo->setReadOnly( true );
144     GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
145
146     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
147
148     /***************************************************************/
149     GroupButtons = new QGroupBox( this, "GroupButtons" );
150     GroupButtons->setColumnLayout(0, Qt::Vertical );
151     GroupButtons->layout()->setSpacing( 0 );
152     GroupButtons->layout()->setMargin( 0 );
153     QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
154     GroupButtonsLayout->setAlignment( Qt::AlignTop );
155     GroupButtonsLayout->setSpacing( 6 );
156     GroupButtonsLayout->setMargin( 11 );
157
158     buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
159     buttonOk->setAutoDefault( TRUE );
160     buttonOk->setDefault( TRUE );
161     GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
162
163     buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
164     buttonApply->setAutoDefault( TRUE );
165     GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
166
167     GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
168
169     buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
170     buttonCancel->setAutoDefault( TRUE );
171     GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
172
173     SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
174
175     /***************************************************************/
176     Init( Sel ) ;
177 }
178
179
180 //=================================================================================
181 // function : ~SMESHGUI_AddSubMeshDlg()
182 // purpose  : Destroys the object and frees any allocated resources
183 //=================================================================================
184 SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
185 {
186     // no need to delete child widgets, Qt does it all for us
187 }
188
189
190 //=================================================================================
191 // function : Init()
192 // purpose  :
193 //=================================================================================
194 void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
195 {
196   mySelection = Sel;
197   mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
198   mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
199
200   myGeomFilter       = new SALOME_TypeFilter( "GEOM" );
201   myMeshFilter       = new SMESH_TypeFilter( MESH );
202   myAlgorithmFilter  = new SMESH_TypeFilter( ALGORITHM );
203   myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
204
205   /* signals and slots connections */
206   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
207   connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
208   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
209
210   connect( SelectButtonC1A1,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
211   connect( SelectButtonC1A2,     SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
212   connect( SelectButtonC1A1Hyp,  SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
213   connect( SelectButtonC1A1Algo, SIGNAL (clicked() ),  this, SLOT( SetEditCurrentArgument() ) ) ;
214
215   connect( mySelection, SIGNAL( currentSelectionChanged() ),      this, SLOT( SelectionIntoArgument() ) );
216   connect( mySMESHGUI,  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
217   connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) ) ;
218   
219   int x, y ;
220   mySMESHGUI->DefineDlgPosition( this, x, y ) ;
221   this->move( x, y ) ;
222   this->show() ; 
223
224   LineEdit_NameMesh->setText( tr( "SMESH_SUBMESH" ) );
225   LineEdit_NameMesh->setFocus() ;
226   myEditCurrentArgument = LineEditC1A1 ;        
227   mySelection->ClearFilters() ;   
228   mySelection->AddFilter( myMeshFilter ) ;
229
230   SelectionIntoArgument();
231 }
232
233 //=================================================================================
234 // function : ClickOnOk()
235 // purpose  :
236 //=================================================================================
237 void SMESHGUI_AddSubMeshDlg::ClickOnOk()
238 {
239   if ( this->ClickOnApply() )
240     this->ClickOnCancel() ;
241 }
242
243 //=================================================================================
244 // function : ClickOnApply()
245 // purpose  :
246 //=================================================================================
247 bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
248 {
249   if (mySMESHGUI->ActiveStudyLocked())
250     return false;
251
252   QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
253   if ( myNameSubMesh.isEmpty() ) {
254     QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
255     return false;
256   }
257   
258   if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
259     return false;
260
261   SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
262   GEOM::GEOM_Object_var myMainShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
263   if ( myMainShape->_is_nil() )
264     return false;
265
266   QAD_WaitCursor wc;
267
268   QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
269
270   // start transaction
271   op->start();
272   
273   // create submesh
274   SMESH::SMESH_subMesh_var aSubMesh = SMESH::AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
275   int nbSuccess = 0;
276   
277   if ( !aSubMesh->_is_nil() ) {
278     // assign hypotheses
279     int nbAlgo = AlgoList.count();
280     int nbHyps = HypoList.count() + nbAlgo;
281     for( int i = 0; i < nbHyps; i++ ) {
282       SALOMEDS::SObject_var aHypSO = SMESH::GetActiveStudyDocument()->FindObjectID
283         ( i < nbAlgo ? AlgoList[i] : HypoList[i-nbAlgo] );
284       if ( !aHypSO->_is_nil() ) {
285         CORBA::Object_var anObject = aHypSO->GetObject();
286         if ( !CORBA::is_nil( anObject ) ) {
287           SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
288           if ( !aHyp->_is_nil() )
289             if ( SMESH::AddHypothesisOnSubMesh( aSubMesh, aHyp ) )
290               nbSuccess++;
291         }
292         else {
293           SCRUTE( CORBA::is_nil( anObject ));
294         }
295       }
296       else {
297         SCRUTE( aHypSO->_is_nil() );
298       }
299     }
300   }
301   else {
302     SCRUTE( aSubMesh->_is_nil() );
303   }
304   
305   // commit transaction
306   op->finish();
307   return ( nbSuccess > 0 );
308 }
309
310
311 //=================================================================================
312 // function : ClickOnCancel()
313 // purpose  :
314 //=================================================================================
315 void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
316 {
317   close();
318 }
319
320 //=======================================================================
321 //function : IsFatherOf
322 //purpose  : 
323 //=======================================================================
324
325 static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
326   if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
327     SALOMEDS::SObject_var aSO = SO->GetFather();
328     while( strlen( aSO->GetID() ) >= strlen( fatherSO->GetID() ) ) {
329       if ( QString( aSO->GetID() ) == QString( fatherSO->GetID() ) )
330         return true;
331       aSO = aSO->GetFather();
332     }
333   }
334   return false;
335 }
336
337 //=================================================================================
338 // function : SelectionIntoArgument()
339 // purpose  : Called when selection as changed or other case
340 //=================================================================================
341 void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
342 {
343   QString aString = ""; 
344   int nbSel = SMESH::GetNameOfSelectedIObjects(mySelection, aString) ;
345
346   if ( myEditCurrentArgument == LineEditC1A1 ) {
347     // mesh
348     if ( nbSel != 1 ) {
349       myMesh = SMESH::SMESH_Mesh::_nil();
350       aString = "";
351     } 
352     else {
353       Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
354       myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO) ;
355       if( myMesh->_is_nil() ) {
356         aString = "";
357       }
358     }
359     myGeomShape = GEOM::GEOM_Object::_nil();
360     LineEditC1A2->setText( "" );
361   }
362   else if ( myEditCurrentArgument == LineEditC1A2 ) {
363     // geom shape
364     if ( nbSel != 1 ) {
365       myGeomShape = GEOM::GEOM_Object::_nil();
366       aString = "";
367     } 
368     else {
369       Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
370       myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO) ;
371       if( myGeomShape->_is_nil() ) {
372         aString = "";
373       }
374       if ( !myMesh->_is_nil() ) {
375         SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
376         GEOM::GEOM_Object_var aMainGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
377         SALOMEDS::SObject_var aMainGeomShapeSO = SMESH::FindSObject( aMainGeomShape );
378         if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( SMESH::GetActiveStudyDocument()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
379           myGeomShape = GEOM::GEOM_Object::_nil();
380           aString = "";
381         }         
382       }
383     }
384   } 
385   else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
386     // hypotheses
387     HypoList.clear();
388     if ( nbSel >= 1 ) {
389       SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
390       for ( ; Itinit.More(); Itinit.Next() ) {
391         HypoList.append( Itinit.Value()->getEntry() );
392       }
393       if ( nbSel > 1 )
394         aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
395     }
396     else {
397       aString = "";
398     }
399   }
400   else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
401     // algorithms
402     AlgoList.clear(); 
403     if ( nbSel >= 1 ) {
404       SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
405       for ( ; Itinit.More(); Itinit.Next() ) {
406         AlgoList.append( Itinit.Value()->getEntry() );
407       }
408       if ( nbSel > 1 )
409         aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
410     }
411     else {
412       aString = "";
413     }
414   }
415   
416   myEditCurrentArgument->setText(aString) ;
417
418   UpdateControlState();
419 }
420
421
422 //=================================================================================
423 // function : SetEditCurrentArgument()
424 // purpose  :
425 //=================================================================================
426 void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
427 {
428   QPushButton* send = (QPushButton*)sender();
429   if(send == SelectButtonC1A1) {
430     LineEditC1A1->setFocus() ;
431     myEditCurrentArgument = LineEditC1A1;
432     mySelection->ClearFilters() ;         
433     mySelection->AddFilter(myMeshFilter) ;
434   } else if (send == SelectButtonC1A2) {
435     LineEditC1A2->setFocus() ;
436     myEditCurrentArgument = LineEditC1A2;
437     mySelection->ClearFilters() ;
438     mySelection->AddFilter(myGeomFilter) ;
439   } else if( send == SelectButtonC1A1Hyp ) {
440     LineEditC1A1Hyp->setFocus() ;
441     myEditCurrentArgument = LineEditC1A1Hyp ;
442     mySelection->ClearFilters() ;         
443     mySelection->AddFilter(myHypothesisFilter) ;
444   } else if( send == SelectButtonC1A1Algo ) {
445     LineEditC1A1Algo->setFocus() ;
446     myEditCurrentArgument = LineEditC1A1Algo ;
447     mySelection->ClearFilters() ;         
448     mySelection->AddFilter(myAlgorithmFilter) ;
449   }
450   SelectionIntoArgument() ;
451 }
452
453 //=================================================================================
454 // function : DeactivateActiveDialog()
455 // purpose  :
456 //=================================================================================
457 void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
458 {
459   if ( GroupC1->isEnabled() ) {
460     disconnect( mySelection, 0, this, 0 );
461     GroupC1->setEnabled(false) ;
462     GroupButtons->setEnabled(false) ;
463   }
464 }
465
466
467 //=================================================================================
468 // function : ActivateThisDialog()
469 // purpose  :
470 //=================================================================================
471 void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
472 {
473   mySMESHGUI->EmitSignalDeactivateDialog() ;   
474   GroupC1->setEnabled(true) ;
475   GroupButtons->setEnabled(true) ;
476   connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
477 }
478
479
480 //=================================================================================
481 // function : enterEvent()
482 // purpose  :
483 //=================================================================================
484 void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
485 {
486   if ( !GroupC1->isEnabled() )
487     ActivateThisDialog() ;
488 }
489
490
491 //=================================================================================
492 // function : closeEvent()
493 // purpose  :
494 //=================================================================================
495 void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
496 {
497   disconnect( mySelection, 0, this, 0 );
498   mySMESHGUI->ResetState() ;
499   mySelection->ClearFilters() ;
500   QDialog::closeEvent( e );
501 }
502
503 //=================================================================================
504 // function : UpdateControlState()
505 // purpose  :
506 //=================================================================================
507 void SMESHGUI_AddSubMeshDlg::UpdateControlState()
508 {
509   bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
510   bool isImportedMesh = false;
511   if ( !myMesh->_is_nil() ) {
512     SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( myMesh );
513     GEOM::GEOM_Object_var myGeomShape = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
514     isImportedMesh = myGeomShape->_is_nil();
515   }
516
517   buttonOk   ->setEnabled( isEnabled && !isImportedMesh );
518   buttonApply->setEnabled( isEnabled && !isImportedMesh );
519 }