]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Additional fix for issue 0020613: EDF 1106 : Modify Node Marker in SMESH and VISU
authorouv <ouv@opencascade.com>
Fri, 14 May 2010 08:20:31 +0000 (08:20 +0000)
committerouv <ouv@opencascade.com>
Fri, 14 May 2010 08:20:31 +0000 (08:20 +0000)
src/VTKViewer/VTKViewer_MarkerDlg.cxx
src/VTKViewer/VTKViewer_MarkerDlg.h

index baa4a1fdac9c70c128edaf3662662dd753e60553..5484bad62040e10071fff2d08aae638a07a539d7 100644 (file)
 #include "VTKViewer_MarkerDlg.h"
 #include "VTKViewer_MarkerWidget.h"
 
+#include <SUIT_Application.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
 #include <QFrame>
 #include <QHBoxLayout>
+#include <QKeyEvent>
 
 /*!
  * Class       : VTKViewer_MarkerDlg
@@ -42,6 +48,8 @@ VTKViewer_MarkerDlg::VTKViewer_MarkerDlg( QWidget* theParent )
   aTopLayout->setSpacing( 0 );
   aTopLayout->setMargin( 0 );
   aTopLayout->addWidget( myMarkerWidget );
+
+  connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
 }
 
 /*!
@@ -51,6 +59,48 @@ VTKViewer_MarkerDlg::~VTKViewer_MarkerDlg()
 {
 }
 
+void VTKViewer_MarkerDlg::setHelpData( const QString& theModuleName,
+                                       const QString& theHelpFileName )
+{
+  myModuleName = theModuleName;
+  myHelpFileName = theHelpFileName;
+}
+
+void VTKViewer_MarkerDlg::keyPressEvent( QKeyEvent* e )
+{
+  QtxDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 ) {
+    e->accept();
+    onHelp();
+  }
+}
+
+void VTKViewer_MarkerDlg::onHelp()
+{
+  if( myModuleName.isNull() || myHelpFileName.isNull() )
+    return;
+
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if (app) 
+    app->onHelpContextModule(myModuleName, myHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
+                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                                                                 platform)).
+                             arg(myHelpFileName));
+  }
+}
+
 void VTKViewer_MarkerDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
 {
   myMarkerWidget->setCustomMarkerMap( theMarkerMap );
index 8cbe935e6db4122ca5e736911eef2b7583352ee0..7e40c6131b00da4bba6a8e8e126bb7fbd262dec8 100644 (file)
@@ -39,6 +39,9 @@ public:
   VTKViewer_MarkerDlg( QWidget* = 0 );
   virtual ~VTKViewer_MarkerDlg();
 
+  void                    setHelpData( const QString& theModuleName,
+                                       const QString& theHelpFileName );
+
   void                    setCustomMarkerMap( VTK::MarkerMap );
   VTK::MarkerMap          getCustomMarkerMap();
 
@@ -48,8 +51,17 @@ public:
   VTK::MarkerScale        getStandardMarkerScale() const;
   int                     getCustomMarkerID() const;
 
+protected:
+  void                    keyPressEvent( QKeyEvent* );
+
+private slots:
+  void                    onHelp();
+
 private:
   VTKViewer_MarkerWidget* myMarkerWidget;
+
+  QString                 myModuleName;
+  QString                 myHelpFileName;
 };
 
 #endif