From: sln Date: Wed, 13 Jul 2005 10:38:54 +0000 (+0000) Subject: 1. canActivate renamed in blockingOperation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d44c393dee57b18cd71f0ad1b9b1e36b954f0a32;p=modules%2Fgui.git 1. canActivate renamed in blockingOperation 2. eventFilter blocks signals to dialog of suspended operation --- diff --git a/src/SalomeApp/SalomeApp_SwitchOp.cxx b/src/SalomeApp/SalomeApp_SwitchOp.cxx index ac40a53ba..42c885391 100755 --- a/src/SalomeApp/SalomeApp_SwitchOp.cxx +++ b/src/SalomeApp/SalomeApp_SwitchOp.cxx @@ -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; + } } } diff --git a/src/SalomeApp/SalomeApp_SwitchOp.h b/src/SalomeApp/SalomeApp_SwitchOp.h index 8a0b2c95d..7723fed09 100755 --- a/src/SalomeApp/SalomeApp_SwitchOp.h +++ b/src/SalomeApp/SalomeApp_SwitchOp.h @@ -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