Salome HOME
4bf4ddeb9bcd6e40e8bdfd3e3e2bcf157f275344
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_NodesDlg.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_NodesDlg.cxx
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
24 //
25
26 // SMESH includes
27 #include "SMESHGUI_NodesDlg.h"
28
29 #include "SMESHGUI.h"
30 #include "SMESHGUI_SpinBox.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34
35 #include <SMESH_Actor.h>
36 #include <SMESH_ActorUtils.h>
37 #include <SMESH_ObjectDef.h>
38
39 #include <SMDS_Mesh.hxx>
40 #include <SMDS_MeshNode.hxx>
41
42 // SALOME GUI includes
43 #include <SUIT_Session.h>
44 #include <SUIT_OverrideCursor.h>
45 #include <SUIT_MessageBox.h>
46 #include <SUIT_Desktop.h>
47 #include <SUIT_ResourceMgr.h>
48
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
51
52 #include <SVTK_ViewWindow.h>
53 #include <VTKViewer_CellLocationsArray.h>
54
55 // SALOME KERNEL includes
56 #include <SALOMEDS_Study.hxx>
57 #include <SALOMEDS_SObject.hxx>
58
59 #include <utilities.h>
60
61 // VTK includes
62 #include <vtkIdList.h>
63 #include <vtkCellArray.h>
64 #include <vtkUnsignedCharArray.h>
65 #include <vtkUnstructuredGrid.h>
66 #include <vtkDataSetMapper.h>
67 #include <vtkRenderer.h>
68 #include <vtkProperty.h>
69 #include <vtkPoints.h>
70
71 // Qt includes
72 #include <QGroupBox>
73 #include <QLabel>
74 #include <QPushButton>
75 #include <QRadioButton>
76 #include <QHBoxLayout>
77 #include <QVBoxLayout>
78 #include <QKeyEvent>
79 #include <QButtonGroup>
80
81 // IDL includes
82 #include <SALOMEconfig.h>
83 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
84
85 #define SPACING 6
86 #define MARGIN  11
87
88 namespace SMESH
89 {
90   void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z )
91   {
92     SUIT_OverrideCursor wc;
93     try {
94       _PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
95       SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
96       aMeshEditor->AddNode( x, y, z );
97       _PTR(Study) aStudy = GetActiveStudyDocument();
98       CORBA::Long anId = aStudy->StudyId();
99       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
100         aVisualObj->Update( true );
101       }
102     } 
103     catch ( SALOME::SALOME_Exception& exc ) {
104       INFOS( "Follow exception was cought:\n\t" << exc.details.text );
105     }
106     catch ( const std::exception& exc ) {
107       INFOS( "Follow exception was cought:\n\t" << exc.what() );
108     } 
109     catch ( ... ) {
110       INFOS( "Unknown exception was cought !!!" );
111     }
112   }
113
114   class TNodeSimulation 
115   {
116     SVTK_ViewWindow*  myViewWindow;
117
118     SALOME_Actor*     myPreviewActor;
119     vtkDataSetMapper* myMapper;
120     vtkPoints*        myPoints;
121
122   public:
123     TNodeSimulation( SVTK_ViewWindow* theViewWindow ):
124       myViewWindow( theViewWindow )
125     {
126       vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
127
128       // Create points
129       myPoints = vtkPoints::New();
130       myPoints->SetNumberOfPoints( 1 );
131       myPoints->SetPoint( 0, 0.0, 0.0, 0.0 );
132
133       // Create cells
134       vtkIdList *anIdList = vtkIdList::New();
135       anIdList->SetNumberOfIds( 1 );
136
137       vtkCellArray *aCells = vtkCellArray::New();
138       aCells->Allocate( 2, 0 );
139
140       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
141       aCellTypesArray->SetNumberOfComponents( 1 );
142       aCellTypesArray->Allocate( 1 );
143
144       anIdList->SetId( 0, 0 );
145       aCells->InsertNextCell( anIdList );
146       aCellTypesArray->InsertNextValue( VTK_VERTEX );
147
148       VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
149       aCellLocationsArray->SetNumberOfComponents( 1 );
150       aCellLocationsArray->SetNumberOfTuples( 1 );
151
152       aCells->InitTraversal();
153       vtkIdType npts = 0;
154       aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) );
155
156       aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
157
158       aGrid->SetPoints( myPoints );
159       aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
160       aCellLocationsArray->Delete();
161       aCellTypesArray->Delete();
162       aCells->Delete();
163       anIdList->Delete();
164
165       // Create and display actor
166       myMapper = vtkDataSetMapper::New();
167       myMapper->SetInput( aGrid );
168       aGrid->Delete();
169
170       myPreviewActor = SALOME_Actor::New();
171       myPreviewActor->SetInfinitive( true );
172       myPreviewActor->VisibilityOff();
173       myPreviewActor->PickableOff();
174       myPreviewActor->SetMapper( myMapper );
175
176       vtkProperty* aProp = vtkProperty::New();
177       aProp->SetRepresentationToPoints();
178
179       vtkFloatingPointType anRGB[3];
180       GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
181       aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
182
183       vtkFloatingPointType aPointSize = GetFloat( "SMESH:node_size", 3 );
184       aProp->SetPointSize( aPointSize );
185
186       myPreviewActor->SetProperty( aProp );
187       aProp->Delete();
188
189       myViewWindow->AddActor( myPreviewActor );
190     }
191
192     void SetPosition( float x, float y, float z )
193     {
194       myPoints->SetPoint( 0, x, y, z );
195       myPoints->Modified();
196       SetVisibility( true );
197     }
198
199     void SetVisibility( bool theVisibility )
200     {
201       myPreviewActor->SetVisibility( theVisibility );
202       RepaintCurrentView();
203     }
204
205     ~TNodeSimulation()
206     {
207       myViewWindow->RemoveActor( myPreviewActor );
208       myPreviewActor->Delete();
209
210       myMapper->RemoveAllInputs();
211       myMapper->Delete();
212
213       myPoints->Delete();
214     }
215   };
216 }
217
218 //=================================================================================
219 // class    : SMESHGUI_NodesDlg()
220 // purpose  :
221 //=================================================================================
222 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): 
223   QDialog( SMESH::GetDesktop( theModule ) ),
224   mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
225   mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
226   mySMESHGUI( theModule )
227 {
228   setModal( false );
229   setAttribute( Qt::WA_DeleteOnClose, true );
230   setWindowTitle( tr("MESH_NODE_TITLE") );
231   setSizeGripEnabled( true );
232   
233   mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) );
234   
235   QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", 
236                                                                    tr( "ICON_DLG_NODE" ) ) );
237   
238   QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this );
239   SMESHGUI_NodesDlgLayout->setSpacing( SPACING );
240   SMESHGUI_NodesDlgLayout->setMargin( MARGIN );
241
242   /***************************************************************/
243   GroupConstructors = new QGroupBox( tr( "MESH_NODE" ), this );
244   QButtonGroup* ButtonGroup = new QButtonGroup(this);
245   QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout( GroupConstructors );
246   GroupConstructorsLayout->setSpacing( SPACING );
247   GroupConstructorsLayout->setMargin( MARGIN );
248
249   Constructor1 = new QRadioButton( GroupConstructors );
250   Constructor1->setIcon( image0 );
251   Constructor1->setChecked( true );
252   
253   GroupConstructorsLayout->addWidget( Constructor1 );
254   ButtonGroup->addButton( Constructor1, 0 );
255
256   /***************************************************************/
257   GroupCoordinates = new QGroupBox( tr( "SMESH_COORDINATES" ), this );
258   QHBoxLayout* GroupCoordinatesLayout = new QHBoxLayout(GroupCoordinates);
259   GroupCoordinatesLayout->setSpacing(SPACING);
260   GroupCoordinatesLayout->setMargin(MARGIN);
261
262   TextLabel_X = new QLabel( tr( "SMESH_X" ), GroupCoordinates );
263   SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates );
264
265   TextLabel_Y = new QLabel( tr( "SMESH_Y" ), GroupCoordinates );
266   SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates );
267
268   TextLabel_Z = new QLabel( tr( "SMESH_Z" ), GroupCoordinates );
269   SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates );
270
271   GroupCoordinatesLayout->addWidget( TextLabel_X );
272   GroupCoordinatesLayout->addWidget( SpinBox_X );
273   GroupCoordinatesLayout->addWidget( TextLabel_Y);
274   GroupCoordinatesLayout->addWidget( SpinBox_Y );
275   GroupCoordinatesLayout->addWidget( TextLabel_Z );
276   GroupCoordinatesLayout->addWidget( SpinBox_Z );
277
278   /***************************************************************/
279   GroupButtons = new QGroupBox( this );
280   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
281   GroupButtonsLayout->setSpacing( SPACING );
282   GroupButtonsLayout->setMargin( MARGIN );
283   buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
284   buttonOk->setAutoDefault( true );
285   buttonOk->setDefault( true );
286   buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
287   buttonApply->setAutoDefault( true );
288   buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons );
289   buttonCancel->setAutoDefault( true );
290   buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
291   buttonHelp->setAutoDefault( true );
292
293   GroupButtonsLayout->addWidget( buttonOk );
294   GroupButtonsLayout->addSpacing( 10 );
295   GroupButtonsLayout->addWidget( buttonApply );
296   GroupButtonsLayout->addSpacing( 10 );
297   GroupButtonsLayout->addStretch();
298   GroupButtonsLayout->addWidget( buttonCancel );
299   GroupButtonsLayout->addWidget( buttonHelp );
300
301   /***************************************************************/
302   SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors );
303   SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates );
304   SMESHGUI_NodesDlgLayout->addWidget( GroupButtons );
305
306   myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor";
307
308   /* Initialisation and display */
309   Init();
310 }
311
312 //=======================================================================
313 // function : ~SMESHGUI_NodesDlg()
314 // purpose  : Destructor
315 //=======================================================================
316 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
317 {
318   delete mySimulation;
319 }
320
321 //=================================================================================
322 // function : Init()
323 // purpose  :
324 //=================================================================================
325 void SMESHGUI_NodesDlg::Init()
326 {
327   /* Get setting of step value from file configuration */
328   double step = 25.0;
329
330   /* min, max, step and decimals for spin boxes */
331   SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
332   SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
333   SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
334   SpinBox_X->SetValue( 0.0 );
335   SpinBox_Y->SetValue( 0.0 );
336   SpinBox_Z->SetValue( 0.0 );
337
338   mySMESHGUI->SetActiveDialogBox( this );
339
340   /* signals and slots connections */
341   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
342   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
343   connect( buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
344   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
345
346   connect( SpinBox_X, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
347   connect( SpinBox_Y, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
348   connect( SpinBox_Z, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) );
349
350   connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ),      SLOT( SelectionIntoArgument() ) );
351   connect( mySMESHGUI,     SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) );
352   /* to close dialog if study frame change */
353   connect( mySMESHGUI,     SIGNAL( SignalStudyFrameChanged() ),      SLOT( ClickOnCancel() ) );
354
355   // set selection mode
356   SMESH::SetPointRepresentation( true );
357   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
358     aViewWindow->SetSelectionMode( NodeSelection );
359
360   SelectionIntoArgument();
361 }
362
363 //=================================================================================
364 // function : ValueChangedInSpinBox()
365 // purpose  :
366 //=================================================================================
367 void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue )
368 {
369   if ( !myMesh->_is_nil() ) {
370     double vx = SpinBox_X->GetValue();
371     double vy = SpinBox_Y->GetValue();
372     double vz = SpinBox_Z->GetValue();
373
374     mySimulation->SetPosition( vx, vy, vz );
375   }
376 }
377
378 //=================================================================================
379 // function : ClickOnOk()
380 // purpose  :
381 //=================================================================================
382 void SMESHGUI_NodesDlg::ClickOnOk()
383 {
384   if ( ClickOnApply() )
385     ClickOnCancel();
386 }
387
388 //=================================================================================
389 // function : ClickOnApply()
390 // purpose  :
391 //=================================================================================
392 bool SMESHGUI_NodesDlg::ClickOnApply()
393 {
394   if ( mySMESHGUI->isActiveStudyLocked() )
395     return false;
396
397   if ( myMesh->_is_nil() ) {
398     SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ),
399                               tr( "MESH_IS_NOT_SELECTED" ) );
400     return false;
401   }
402
403   /* Recup args and call method */
404   double x = SpinBox_X->GetValue();
405   double y = SpinBox_Y->GetValue();
406   double z = SpinBox_Z->GetValue();
407   mySimulation->SetVisibility( false );
408   SMESH::AddNode( myMesh, x, y, z );
409   SMESH::SetPointRepresentation( true );
410
411   // select myMesh
412   SALOME_ListIO aList;
413   mySelectionMgr->selectedObjects( aList );
414   if ( aList.Extent() != 1 ) {
415     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() ) {
416       vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
417       aCollection->InitTraversal();
418       while ( vtkActor *anAct = aCollection->GetNextActor() ) {
419         if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) ) {
420           if ( anActor->hasIO() ) {
421             if ( SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>( anActor->GetObject().get() ) ) {
422               if ( myMesh->_is_equivalent( aMeshObj->GetMeshServer() ) ) {
423                 aList.Clear();
424                 aList.Append( anActor->getIO() );
425                 mySelectionMgr->setSelectedObjects( aList, false );
426                 break;
427               }
428             }
429           }
430         }
431       }
432     }
433   }
434   return true;
435 }
436
437 //=================================================================================
438 // function : ClickOnCancel()
439 // purpose  :
440 //=================================================================================
441 void SMESHGUI_NodesDlg::ClickOnCancel()
442 {
443   disconnect( mySelectionMgr, 0, this, 0 );
444   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
445     aViewWindow->SetSelectionMode( ActorSelection );
446
447   mySimulation->SetVisibility( false );
448   SMESH::SetPointRepresentation( false );
449   mySMESHGUI->ResetState();
450
451   reject();
452 }
453
454 //=================================================================================
455 // function : ClickOnHelp()
456 // purpose  :
457 //=================================================================================
458 void SMESHGUI_NodesDlg::ClickOnHelp()
459 {
460   LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
461   if ( app ) 
462     app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : 
463                               QString( "" ), myHelpFileName );
464   else {
465     QString platform;
466 #ifdef WIN32
467     platform = "winapplication";
468 #else
469     platform = "application";
470 #endif
471     SUIT_MessageBox::warning( this, tr("WRN_WARNING"),
472                               tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
473                               arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
474                                                                     platform ) ).
475                               arg( myHelpFileName ) );
476   }
477 }
478
479 //=================================================================================
480 // function : SelectionIntoArgument()
481 // purpose  : Called when selection as changed or other case
482 //=================================================================================
483 void SMESHGUI_NodesDlg::SelectionIntoArgument()
484 {
485   if ( !GroupConstructors->isEnabled() )
486     return;
487
488   mySimulation->SetVisibility( false );
489   SMESH::SetPointRepresentation( true );
490
491   const SALOME_ListIO& aList = mySelector->StoredIObjects();
492   if ( aList.Extent() == 1 ) {
493     Handle(SALOME_InteractiveObject) anIO = aList.First();
494     if ( anIO->hasEntry() ) {
495       myMesh = SMESH::GetMeshByIO( anIO );
496       if ( myMesh->_is_nil() ) return;
497       QString aText;
498       if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) {
499         if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) {
500           if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) {
501             if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) {
502               SpinBox_X->SetValue( aNode->X() );
503               SpinBox_Y->SetValue( aNode->Y() );
504               SpinBox_Z->SetValue( aNode->Z() );
505             }
506           }
507         }
508       }
509       mySimulation->SetPosition( SpinBox_X->GetValue(),
510                                  SpinBox_Y->GetValue(),
511                                  SpinBox_Z->GetValue() );
512     }
513   }
514 }
515
516 //=================================================================================
517 // function : closeEvent()
518 // purpose  :
519 //=================================================================================
520 void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* )
521 {
522   this->ClickOnCancel(); /* same than click on cancel button */
523 }
524
525 //=================================================================================
526 // function : hideEvent()
527 // purpose  : caused by ESC key
528 //=================================================================================
529 void SMESHGUI_NodesDlg::hideEvent( QHideEvent* )
530 {
531   if ( !isMinimized() )
532     ClickOnCancel();
533 }
534
535 //=================================================================================
536 // function : enterEvent()
537 // purpose  : to reactivate this dialog box when mouse enter onto the window
538 //=================================================================================
539 void SMESHGUI_NodesDlg::enterEvent( QEvent* )
540 {
541   if ( !GroupConstructors->isEnabled() )
542     ActivateThisDialog();
543 }
544
545 //=================================================================================
546 // function : DeactivateActiveDialog()
547 // purpose  : public slot to deactivate if active
548 //=================================================================================
549 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
550 {
551   if ( GroupConstructors->isEnabled() ) {
552     GroupConstructors->setEnabled( false );
553     GroupCoordinates->setEnabled( false );
554     GroupButtons->setEnabled( false );
555     mySimulation->SetVisibility( false );
556     mySMESHGUI->ResetState();
557     mySMESHGUI->SetActiveDialogBox( 0 );
558   }
559 }
560
561 //=================================================================================
562 // function : ActivateThisDialog()
563 // purpose  :
564 //=================================================================================
565 void SMESHGUI_NodesDlg::ActivateThisDialog()
566 {
567   mySMESHGUI->EmitSignalDeactivateDialog();
568   GroupConstructors->setEnabled( true );
569   GroupCoordinates->setEnabled( true );
570   GroupButtons->setEnabled( true );
571
572   SMESH::SetPointRepresentation( true );
573   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) )
574     aViewWindow->SetSelectionMode( NodeSelection );
575
576   SelectionIntoArgument();
577 }
578
579 //=================================================================================
580 // function : keyPressEvent()
581 // purpose  :
582 //=================================================================================
583 void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
584 {
585   QDialog::keyPressEvent( e );
586   if ( e->isAccepted() )
587     return;
588
589   if ( e->key() == Qt::Key_F1 ) {
590     e->accept();
591     ClickOnHelp();
592   }
593 }