From 146ccd682dac563dcfedd51f4f2a1c65d803ca1c Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 14 May 2010 08:20:31 +0000 Subject: [PATCH] Additional fix for issue 0020613: EDF 1106 : Modify Node Marker in SMESH and VISU --- src/VTKViewer/VTKViewer_MarkerDlg.cxx | 50 +++++++++++++++++++++++++++ src/VTKViewer/VTKViewer_MarkerDlg.h | 12 +++++++ 2 files changed, 62 insertions(+) diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.cxx b/src/VTKViewer/VTKViewer_MarkerDlg.cxx index baa4a1fda..5484bad62 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.cxx +++ b/src/VTKViewer/VTKViewer_MarkerDlg.cxx @@ -20,8 +20,14 @@ #include "VTKViewer_MarkerDlg.h" #include "VTKViewer_MarkerWidget.h" +#include +#include +#include +#include + #include #include +#include /*! * 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 ); diff --git a/src/VTKViewer/VTKViewer_MarkerDlg.h b/src/VTKViewer/VTKViewer_MarkerDlg.h index 8cbe935e6..7e40c6131 100644 --- a/src/VTKViewer/VTKViewer_MarkerDlg.h +++ b/src/VTKViewer/VTKViewer_MarkerDlg.h @@ -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 -- 2.39.2