Salome HOME
Merge remote branch 'origin/akl/22379'
[modules/gui.git] / src / LightApp / LightApp_EventFilter.cxx
index 77ab42c9f37bbacdb876c001643d8e0915616fd0..6803869d2464620d9d7d50780573fea34f28224f 100644 (file)
@@ -1,17 +1,20 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
@@ -21,7 +24,9 @@
 
 #include <SUIT_Desktop.h>
 
-#include <qapplication.h>
+#include <QApplication>
+
+#include <SALOME_Event.h>
 
 LightApp_EventFilter* LightApp_EventFilter::myFilter = NULL;
 
@@ -50,19 +55,36 @@ bool LightApp_EventFilter::eventFilter( QObject* o, QEvent* e )
       SUIT_Desktop* aDesktop = 0;
       
       while( parent )
-       {
-         if ( aDesktop = dynamic_cast<SUIT_Desktop*>(parent) )
-           break;
-         parent = parent->parentWidget();
-       }
+        {
+          aDesktop = dynamic_cast<SUIT_Desktop*>(parent);
+          if ( aDesktop )
+            break;
+          parent = parent->parentWidget();
+        }
       
       if ( aDesktop )
-       aDesktop->emitActivated();
+        aDesktop->emitActivated();
+    }
+
+  else if(e->type() == SALOME_EVENT)
+    {
+      SALOME_Event* aSE = (SALOME_Event*)((SALOME_CustomEvent*)e)->data();
+      processEvent(aSE);
+      ((SALOME_CustomEvent*)e)->setData( 0 );
+      return true;
     }
   
   return QObject::eventFilter( o, e );
 }
 
+/*!Process event.*/
+void LightApp_EventFilter::processEvent( SALOME_Event* theEvent )
+{
+  if(theEvent)
+    theEvent->ExecutePostedEvent();
+}
+
+
 /*!Create new instance of LightApp_EventFilter*/
 void LightApp_EventFilter::Init()
 {