]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for IPAL20242 (Qt4 porting: SIGSEGV on several studies). TG_TRIPOLI_qt4_porting V5_1_0a1
authormzn <mzn@opencascade.com>
Fri, 19 Sep 2008 12:45:12 +0000 (12:45 +0000)
committermzn <mzn@opencascade.com>
Fri, 19 Sep 2008 12:45:12 +0000 (12:45 +0000)
src/SalomeApp/SalomeApp_VisualState.cxx
src/SalomeApp/SalomeApp_VisualState.h

index a3f14ddb6e105cb597af13787ba1504e9f211edd..e3de909d919708069e35795372b589f052963ed1 100644 (file)
@@ -43,7 +43,8 @@
   Constructor.
 */
 SalomeApp_VisualState::SalomeApp_VisualState( SalomeApp_Application* app )
-  : myApp( app )
+  : QObject(),
+    myApp( app )
 {
 }  
 
@@ -192,6 +193,8 @@ void SalomeApp_VisualState::restoreState(int savePoint)
   _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint );
   _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
 
+  qApp->installEventFilter( this );
+
   //Remove all already existent veiwers and their views
   ViewManagerList lst;
   myApp->viewManagers( lst );
@@ -206,7 +209,7 @@ void SalomeApp_VisualState::restoreState(int savePoint)
 
   // parameters of view windows are stored in a map for restoring after restoring of the workstack
   QMap<SUIT_ViewWindow*, QString> viewersParameters;
-
+  
   for ( int i = 0; i < nbViewers; i++ ) {
     std::string viewerEntry = ip->getValue( "AP_VIEWERS_LIST", i );
     std::vector<std::string> veiewerParams = ip->parseValue(viewerEntry,'_');
@@ -303,6 +306,8 @@ void SalomeApp_VisualState::restoreState(int savePoint)
     if ( activeViewName == mapIt.key()->objectName().toStdString() )
       mapIt.key()->setFocus();
   }
+
+  qApp->removeEventFilter( this );
   
   //  for ( it.toFirst(); it.current(); ++it ) {
   //    int view_count = it.current()->getViewsCount();
@@ -322,3 +327,21 @@ void SalomeApp_VisualState::restoreState(int savePoint)
   //    }
   //  }
 }
+
+/*!
+  Custom event filter
+*/
+bool SalomeApp_VisualState::eventFilter( QObject* o, QEvent* e )
+{
+  // eat keyboard and mouse events
+  QEvent::Type aType = e->type();
+  if ( aType == QEvent::MouseButtonDblClick ||
+       aType == QEvent::MouseButtonPress ||
+       aType == QEvent::MouseButtonRelease ||
+       aType == QEvent::MouseMove ||
+       aType == QEvent::KeyPress ||
+       aType == QEvent::KeyRelease )
+    return true;
+  
+  return QObject::eventFilter( o, e );
+}
index dae7fc091631906e70722b6bccc90f4946bd1add..129cb2fe6be8bbf093e8c674c848d8d22333eb7d 100644 (file)
 
 #include "SalomeApp.h"
 
+#include <QObject>
+
 class SalomeApp_Application;
 
-class SALOMEAPP_EXPORT SalomeApp_VisualState
+class SALOMEAPP_EXPORT SalomeApp_VisualState: public QObject
 {
 public:
   SalomeApp_VisualState( SalomeApp_Application* );
@@ -36,6 +38,9 @@ public:
   virtual int            storeState();
   virtual void           restoreState( int savePoint );
 
+private:
+   virtual bool eventFilter( QObject* o, QEvent* e );
+
 protected:
   SalomeApp_Application* myApp;
 };