]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
1. canActivate renamed in blockingOperation
authorsln <sln@opencascade.com>
Wed, 13 Jul 2005 10:38:54 +0000 (10:38 +0000)
committersln <sln@opencascade.com>
Wed, 13 Jul 2005 10:38:54 +0000 (10:38 +0000)
2. eventFilter blocks signals to dialog of suspended operation

src/SalomeApp/SalomeApp_SwitchOp.cxx
src/SalomeApp/SalomeApp_SwitchOp.h

index ac40a53baa834162b6f8bf86181e812ab1d9deb0..42c8853913f958fc05809ff900410f7daf74e194 100755 (executable)
@@ -43,15 +43,6 @@ SalomeApp_SwitchOp::~SalomeApp_SwitchOp()
   
 }
 
-/*!
- * \brief SLOT. Called when number of operations changed
-*
-*
-*/
-void SalomeApp_SwitchOp::onOperation()
-{
-}
-
 /*!
  * \brief Get module
 *
@@ -107,24 +98,6 @@ SalomeApp_Operation* SalomeApp_SwitchOp::operation( QWidget* theWg ) const
   return 0;
 }
 
-/*!
- * \brief Connect signals of operation on the slots of object
-  * \param theOp - operation for connection
-*
-* Connect signals of operation on the slots of object. This method is called by module
-* when it creates operation
-*/
-void SalomeApp_SwitchOp::connect( SalomeApp_Operation* theOp )
-{
-// to do: ???
-//  void              started( SUIT_Operation* );
-//  void              aborted( SUIT_Operation* );
-//  void              resumed( SUIT_Operation* );
-//  void              committed( SUIT_Operation* );
-//  void              suspended( SUIT_Operation* );
-//  void              stopped( SUIT_Operation* );
-}
-
 /*!
  * \brief Event filter
   * \param theObj - object
@@ -137,13 +110,32 @@ bool SalomeApp_SwitchOp::eventFilter( QObject* theObj, QEvent* theEv )
 {
   if ( theObj->inherits( "QWidget" ) && ( theEv->type() == QEvent::Enter ) )
   {
+    QEvent::Type aType = theEv->type();
     SalomeApp_Operation* anOp = operation( (QWidget*)theObj );
-    if ( anOp && !anOp->isActive() && anOp->isAutoResumed() )
+    if ( anOp )
     {
-      if ( study() )
+      switch ( aType )
       {
-        if ( study()->canActivate( anOp ) )
-          study()->resume( anOp );
+        case QEvent::Enter:
+        {
+          if ( !anOp->isActive() && anOp->isAutoResumed() &&
+               study() && !study()->blockingOperation( anOp ) )
+            study()->resume( anOp );
+        }
+        break;
+        
+        case QEvent::MouseButtonRelease:
+        case QEvent::MouseButtonPress:
+        case QEvent::MouseButtonDblClick:
+        case QEvent::MouseMove:
+        case QEvent::KeyPress:
+        case QEvent::KeyRelease:
+        {
+          if ( !anOp->isActive() )
+            return true;
+        }
+        break;
+        
       }
     }
   }
index 8a0b2c95dec25600b81d347b518807c476358933..7723fed0924e0d8d389524a68f62ca4e0fe9d8d2 100755 (executable)
@@ -34,7 +34,7 @@ class SUIT_Study;
  * Other dialogs are disabled. This class installs event filter on application. When mouse
  * cursor is moved above disabled dialog corresponding event is catched by this class.
  * It finds corresponding operation and verify whether operation can be resumed (see
- * SUIT_Study::canActivate( SUIT_Operation* ) method). If yes then current active
+ * SUIT_Study::isDenied( SUIT_Operation* ) method). If yes then current active
  * operation is suspended and new operation activated. Module contains this class as a
  * field. Then module is created instance of this class created too.
  */
@@ -47,24 +47,15 @@ public:
   SalomeApp_SwitchOp( SalomeApp_Module* );
   virtual ~SalomeApp_SwitchOp();
 
-  void                      connect( SalomeApp_Operation* );
-
   // Redefined from base class
   bool                      eventFilter( QObject*, QEvent* );
 
-private slots:
-
-  void                      onOperation();
-
 private:
 
   SalomeApp_Module*         module() const;
   SalomeApp_Operation*      operation( QWidget* ) const;
   SUIT_Study*               study() const;
 
-private:
-
-  
 };
 
 #endif