Salome HOME
Porting SMESH module to Qt 4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MoveNodesDlg.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SMESHGUI_MoveNodesDlg.cxx
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
24 //
25
26 // SMESH includes
27 #include "SMESHGUI_MoveNodesDlg.h"
28
29 #include "SMESHGUI.h"
30 #include "SMESHGUI_SpinBox.h"
31 #include "SMESHGUI_IdValidator.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35
36 #include <SMESH_Actor.h>
37 #include <SMDS_Mesh.hxx>
38
39 // SALOME GUI includes
40 #include <LightApp_SelectionMgr.h>
41 #include <LightApp_Application.h>
42 #include <SUIT_ResourceMgr.h>
43 #include <SUIT_Desktop.h>
44 #include <SUIT_Session.h>
45 #include <SUIT_MessageBox.h>
46
47 #include <SVTK_ViewModel.h>
48 #include <SVTK_ViewWindow.h>
49 #include <SALOME_ListIO.hxx>
50
51 #include <VTKViewer_CellLocationsArray.h>
52
53 // OCCT includes
54 #include <TColStd_MapOfInteger.hxx>
55
56 // VTK includes
57 #include <vtkIdList.h>
58 #include <vtkCellArray.h>
59 #include <vtkUnsignedCharArray.h>
60 #include <vtkUnstructuredGrid.h>
61 #include <vtkDataSetMapper.h>
62 #include <vtkProperty.h>
63
64 // Qt includes
65 #include <QGroupBox>
66 #include <QLabel>
67 #include <QLineEdit>
68 #include <QPushButton>
69 #include <QRadioButton>
70 #include <QHBoxLayout>
71 #include <QVBoxLayout>
72 #include <QKeyEvent>
73
74 // IDL includes
75 #include <SALOMEconfig.h>
76 #include CORBA_SERVER_HEADER(SMESH_Mesh)
77 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
78
79 #define SPACING 6
80 #define MARGIN  11
81
82 //=================================================================================
83 // name    : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
84 // Purpose :
85 //=================================================================================
86 SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule):
87   QDialog(SMESH::GetDesktop(theModule)),
88   mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
89   mySMESHGUI(theModule)
90 {
91   myPreviewActor = 0;
92   myBusy = false;
93
94   setModal(false);
95   setWindowTitle(tr("CAPTION"));
96
97   QVBoxLayout* aDlgLay = new QVBoxLayout(this);
98   aDlgLay->setSpacing(SPACING);
99   aDlgLay->setMargin(MARGIN);
100
101   QWidget* aMainFrame = createMainFrame  (this);
102   QWidget* aBtnFrame  = createButtonFrame(this);
103
104   aDlgLay->addWidget(aMainFrame);
105   aDlgLay->addWidget(aBtnFrame);
106
107   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
108
109   myHelpFileName = "moving_nodes_page.html";
110
111   Init();
112 }
113
114 //=======================================================================
115 // name    : SMESHGUI_MoveNodesDlg::createButtonFrame
116 // Purpose : Create frame containing buttons
117 //=======================================================================
118 QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
119 {
120   QFrame* aFrame = new QFrame(theParent);
121   aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
122
123   myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
124   myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
125   myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
126   myHelpBtn   = new QPushButton(tr("SMESH_BUT_HELP"),  aFrame);
127
128   QHBoxLayout* aLay = new QHBoxLayout(aFrame);
129   aLay->setSpacing(SPACING);
130   aLay->setMargin(MARGIN);
131
132   aLay->addWidget(myOkBtn);
133   aLay->addSpacing(10);
134   aLay->addWidget(myApplyBtn);
135   aLay->addSpacing(10);
136   aLay->addStretch();
137   aLay->addWidget(myCloseBtn);
138   aLay->addWidget(myHelpBtn);
139
140   connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
141   connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
142   connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
143   connect(myHelpBtn,  SIGNAL(clicked()), SLOT(onHelp()));
144
145   return aFrame;
146 }
147
148 //=======================================================================
149 // name    : SMESHGUI_MoveNodesDlg::createMainFrame
150 // Purpose : Create frame containing dialog's input fields
151 //=======================================================================
152 QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
153 {
154   QWidget* aFrame = new QWidget(theParent);
155
156   QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
157   QPixmap iconSelect   (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
158
159   //------------------------------------------------------------
160   QGroupBox* aPixGrp = new QGroupBox(tr("MESH_NODE"), aFrame);
161   QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
162   aPixGrpLayout->setSpacing(SPACING);
163   aPixGrpLayout->setMargin(MARGIN);
164
165   QRadioButton* aRBut = new QRadioButton(aPixGrp);
166   aRBut->setIcon(iconMoveNode);
167   aRBut->setChecked(true);
168
169   aPixGrpLayout->addWidget(aRBut);
170   aPixGrpLayout->addStretch();
171
172   //------------------------------------------------------------
173   QGroupBox* anIdGrp = new QGroupBox(tr("SMESH_MOVE"), aFrame);
174   QHBoxLayout* anIdGrpLayout = new QHBoxLayout(anIdGrp);
175   anIdGrpLayout->setSpacing(SPACING);
176   anIdGrpLayout->setMargin(MARGIN);
177
178   QLabel* idLabl = new QLabel(tr("NODE_ID"), anIdGrp);
179   QPushButton* idBtn = new QPushButton(anIdGrp);
180   idBtn->setIcon(iconSelect);
181   myId = new QLineEdit(anIdGrp);
182   myId->setValidator(new SMESHGUI_IdValidator(this, 1));
183
184   anIdGrpLayout->addWidget(idLabl);
185   anIdGrpLayout->addWidget(idBtn);
186   anIdGrpLayout->addWidget(myId);
187
188   //------------------------------------------------------------
189   QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame);
190   QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp);
191   aCoordGrpLayout->setSpacing(SPACING);
192   aCoordGrpLayout->setMargin(MARGIN);
193
194   QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
195   myX = new SMESHGUI_SpinBox(aCoordGrp);
196
197   QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
198   myY = new SMESHGUI_SpinBox(aCoordGrp);
199
200   QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
201   myZ = new SMESHGUI_SpinBox(aCoordGrp);
202
203   aCoordGrpLayout->addWidget(aXLabel);
204   aCoordGrpLayout->addWidget(myX);
205   aCoordGrpLayout->addWidget(aYLabel);
206   aCoordGrpLayout->addWidget(myY);
207   aCoordGrpLayout->addWidget(aZLabel);
208   aCoordGrpLayout->addWidget(myZ);
209
210   //------------------------------------------------------------
211   myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
212   myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
213   myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY);
214
215   //------------------------------------------------------------
216   QVBoxLayout* aLay = new QVBoxLayout(aFrame);
217   aLay->setMargin(0);
218   aLay->setMargin(SPACING);
219   aLay->addWidget(aPixGrp);
220   aLay->addWidget(anIdGrp);
221   aLay->addWidget(aCoordGrp);
222
223   //------------------------------------------------------------
224   // connect signale and slots
225   connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
226   connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
227   connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
228   connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
229
230   return aFrame;
231 }
232
233 //=======================================================================
234 // name    : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
235 // Purpose :
236 //=======================================================================
237 SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
238 {
239   erasePreview();
240 }
241
242 //=======================================================================
243 // name    : SMESHGUI_MoveNodesDlg::Init
244 // Purpose : Init dialog fields
245 //=======================================================================
246 void SMESHGUI_MoveNodesDlg::Init()
247 {
248   myPreviewActor = 0;
249   myMeshActor = 0;
250   myBusy = false;
251
252   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
253
254   // selection and SMESHGUI
255   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
256   connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
257   connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
258
259   reset();
260   setEnabled(true);
261
262   // set selection mode
263   SMESH::SetPointRepresentation(true);
264   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
265     aViewWindow->SetSelectionMode(NodeSelection);
266
267   onSelectionDone();
268 }
269
270 //=======================================================================
271 // name    : SMESHGUI_MoveNodesDlg::isValid
272 // Purpose : Verify validity of entry information
273 //=======================================================================
274 bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
275 {
276   if (myId->text().isEmpty()) {
277     if (theMess)
278       SUIT_MessageBox::information(this, tr("SMESH_WARNING"),
279                                    tr("NODE_ID_IS_NOT_DEFINED"));
280     return false;
281   }
282   return true;
283 }
284
285 //=======================================================================
286 // name    : SMESHGUI_MoveNodesDlg::reset
287 // Purpose : Reset the dialog state
288 //=======================================================================
289 void SMESHGUI_MoveNodesDlg::reset()
290 {
291   myId->clear();
292   myX->SetValue(0);
293   myY->SetValue(0);
294   myZ->SetValue(0);
295   redisplayPreview();
296   updateButtons();
297 }
298
299 //=======================================================================
300 // name    : SMESHGUI_MoveNodesDlg::onApply
301 // Purpose : SLOT called when "Apply" button pressed.
302 //=======================================================================
303 bool SMESHGUI_MoveNodesDlg::onApply()
304 {
305   if (mySMESHGUI->isActiveStudyLocked())
306     return false;
307
308   if (!isValid(true))
309     return false;
310
311   SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
312   if (aMesh->_is_nil()) {
313     SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
314                                  tr("SMESHG_NO_MESH"));
315     return false;
316   }
317
318   SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
319   if (aMeshEditor->_is_nil())
320     return false;
321
322   int anId = myId->text().toInt();
323   bool aResult = false;
324   try {
325     aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
326   } catch (...) {
327   }
328
329   if (aResult) {
330     SALOME_ListIO aList;
331     aList.Append(myMeshActor->getIO());
332     mySelectionMgr->setSelectedObjects(aList,false);
333     SMESH::UpdateView();
334     reset();
335   }
336
337   return aResult;
338 }
339
340 //=======================================================================
341 // name    : SMESHGUI_MoveNodesDlg::onOk
342 // Purpose : SLOT called when "Ok" button pressed.
343 //=======================================================================
344 void SMESHGUI_MoveNodesDlg::onOk()
345 {
346   if (onApply())
347     onClose();
348 }
349
350 //=======================================================================
351 // name    : SMESHGUI_MoveNodesDlg::onClose
352 // Purpose : SLOT called when "Close" button pressed. Close dialog
353 //=======================================================================
354 void SMESHGUI_MoveNodesDlg::onClose()
355 {
356   //mySelectionMgr->clearSelected();
357   SMESH::SetPointRepresentation(false);
358   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
359     aViewWindow->SetSelectionMode(ActorSelection);
360   disconnect(mySelectionMgr, 0, this, 0);
361   disconnect(mySMESHGUI, 0, this, 0);
362   erasePreview();
363   mySMESHGUI->ResetState();
364   reject();
365 }
366
367 //=================================================================================
368 // function : onHelp()
369 // purpose  :
370 //=================================================================================
371 void SMESHGUI_MoveNodesDlg::onHelp()
372 {
373   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
374   if (app) 
375     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
376   else {
377                 QString platform;
378 #ifdef WIN32
379                 platform = "winapplication";
380 #else
381                 platform = "application";
382 #endif
383     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
384                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
385                              arg(app->resourceMgr()->stringValue("ExternalBrowser", 
386                                                                  platform)).
387                              arg(myHelpFileName));
388   }
389 }
390
391 //=======================================================================
392 // name    : SMESHGUI_MoveNodesDlg::onTextChange
393 // Purpose :
394 //=======================================================================
395 void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
396 {
397   if (myBusy) return;
398
399   myOkBtn->setEnabled(false);
400   myApplyBtn->setEnabled(false);
401   erasePreview();
402
403   // select entered node
404   if(myMeshActor){
405     if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
406       myBusy = true;
407       Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
408       SALOME_ListIO aList;
409       aList.Append(anIO);
410       mySelectionMgr->setSelectedObjects(aList,false);
411       myBusy = false;
412
413       if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
414         TColStd_MapOfInteger aListInd;
415         aListInd.Add(anElem->GetID());
416         mySelector->AddOrRemoveIndex(anIO,aListInd, false);
417         if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
418           aViewWindow->highlight(anIO,true,true);
419         
420         onSelectionDone();
421       }
422     }
423   }
424 }
425
426 //=======================================================================
427 // name    : SMESHGUI_MoveNodesDlg::onSelectionDone
428 // Purpose : SLOT called when selection changed
429 //=======================================================================
430 void SMESHGUI_MoveNodesDlg::onSelectionDone()
431 {
432   if (myBusy) return;
433   myMeshActor = 0;
434
435   SALOME_ListIO aList;
436   mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
437
438   if (aList.Extent() == 1) {
439     Handle(SALOME_InteractiveObject) anIO = aList.First();
440     myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
441     if(myMeshActor){
442       QString aText;
443       if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
444         if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
445           if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
446             myBusy = true;
447             myId->setText(aText);
448             myX->SetValue(aNode->X());
449             myY->SetValue(aNode->Y());
450             myZ->SetValue(aNode->Z());
451             myBusy = false;
452             erasePreview(); // avoid overlapping of a selection and a preview
453             updateButtons();
454             return;
455           }
456         }
457       }
458     }
459   }
460
461   reset();
462 }
463
464 //=======================================================================
465 // name    : SMESHGUI_MoveNodesDlg::onDeactivate
466 // Purpose : SLOT called when dialog must be deativated
467 //=======================================================================
468 void SMESHGUI_MoveNodesDlg::onDeactivate()
469 {
470   setEnabled(false);
471   erasePreview();
472 }
473
474 //=======================================================================
475 // name    : SMESHGUI_MoveNodesDlg::enterEvent
476 // Purpose : Event filter
477 //=======================================================================
478 void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
479 {
480   if (!isEnabled()) {
481     mySMESHGUI->EmitSignalDeactivateDialog();
482
483     // set selection mode
484     SMESH::SetPointRepresentation(true);
485     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
486       aViewWindow->SetSelectionMode(NodeSelection);
487
488     redisplayPreview();
489
490     setEnabled(true);
491   }
492 }
493
494 //=======================================================================
495 // name    : SMESHGUI_MoveNodesDlg::closeEvent
496 // Purpose :
497 //=======================================================================
498 void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
499 {
500   onClose();
501   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
502     aViewWindow->Repaint();
503 }
504
505 //=======================================================================
506 // name    : SMESHGUI_MoveNodesDlg::hideEvent
507 // Purpose : may be caused by ESC key
508 //=======================================================================
509 void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
510 {
511   if (!isMinimized())
512     onClose();
513 }
514
515 //=======================================================================
516 // name    : SMESHGUI_MoveNodesDlg::updateButtons
517 // Purpose : Update buttons state
518 //=======================================================================
519 void SMESHGUI_MoveNodesDlg::updateButtons()
520 {
521   bool isEnabled = isValid(false);
522   myOkBtn->setEnabled(isEnabled);
523   myApplyBtn->setEnabled(isEnabled);
524 }
525
526 //=======================================================================
527 // name    : SMESHGUI_MoveNodesDlg::erasePreview
528 // Purpose : Erase preview
529 //=======================================================================
530 void  SMESHGUI_MoveNodesDlg::erasePreview()
531 {
532   if (myPreviewActor == 0)
533     return;
534
535   SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
536   if (aViewWindow)
537     aViewWindow->RemoveActor(myPreviewActor);
538   myPreviewActor->Delete();
539   myPreviewActor = 0;
540   if (aViewWindow)
541     aViewWindow->Repaint();
542 }
543
544 //=======================================================================
545 // name    : SMESHGUI_MoveNodesDlg::redisplayPreview
546 // Purpose : Redisplay preview
547 //=======================================================================
548 void SMESHGUI_MoveNodesDlg::redisplayPreview()
549 {
550   if (myBusy)
551     return;
552
553   if (myPreviewActor != 0)
554     erasePreview();
555
556   if (!isValid(false))
557     return;
558
559   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
560
561   vtkPoints* aPoints = vtkPoints::New();
562   aPoints->SetNumberOfPoints(1);
563   aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
564
565   // Create cells
566
567   vtkIdList *anIdList = vtkIdList::New();
568   anIdList->SetNumberOfIds(1);
569
570   vtkCellArray *aCells = vtkCellArray::New();
571   aCells->Allocate(2, 0);
572
573   vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
574   aCellTypesArray->SetNumberOfComponents(1);
575   aCellTypesArray->Allocate(1);
576
577   anIdList->SetId(0, 0);
578   aCells->InsertNextCell(anIdList);
579   aCellTypesArray->InsertNextValue(VTK_VERTEX);
580   anIdList->Delete();
581
582   VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
583   aCellLocationsArray->SetNumberOfComponents(1);
584   aCellLocationsArray->SetNumberOfTuples(1);
585
586   aCells->InitTraversal();
587   vtkIdType npts;
588   aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
589
590   aGrid->SetPoints(aPoints);
591   aPoints->Delete();
592
593   aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
594   aCellLocationsArray->Delete();
595   aCellTypesArray->Delete();
596   aCells->Delete();
597
598   // Create and display actor
599   vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
600   aMapper->SetInput(aGrid);
601   aGrid->Delete();
602
603   myPreviewActor = SALOME_Actor::New();
604   myPreviewActor->PickableOff();
605   myPreviewActor->SetMapper(aMapper);
606   aMapper->Delete();
607
608   vtkProperty* aProp = vtkProperty::New();
609   aProp->SetRepresentationToWireframe();
610   aProp->SetColor(250, 0, 250);
611   aProp->SetPointSize(5);
612   myPreviewActor->SetProperty(aProp);
613   aProp->Delete();
614
615   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
616     {
617       aViewWindow->AddActor(myPreviewActor);
618       aViewWindow->Repaint();
619     }
620 }
621
622 //=================================================================================
623 // function : keyPressEvent()
624 // purpose  :
625 //=================================================================================
626 void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e )
627 {
628   QDialog::keyPressEvent( e );
629   if ( e->isAccepted() )
630     return;
631
632   if ( e->key() == Qt::Key_F1 ) {
633     e->accept();
634     onHelp();
635   }
636 }