Salome HOME
updated copyright message
[modules/gui.git] / src / LightApp / LightApp_SwitchOp.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 67283f3..7b4b99f
@@ -1,17 +1,20 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// Copyright (C) 2007-2023  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
 #include <CAM_Application.h>
 #include <SUIT_Operation.h>
 #include <SUIT_Study.h>
-#include <qevent.h>
-#include <qwidget.h>
-#include <qptrlist.h>
-#include <qapplication.h>
+
+#include <QEvent>
+#include <QWidget>
+#include <QList>
+#include <QApplication>
 
 /*!
  * \brief Constructor
@@ -93,14 +97,16 @@ LightApp_Operation* LightApp_SwitchOp::operation( QWidget* theWg ) const
   // try to find operation corresponding to the dialog
   if ( aDlg != 0 && study() != 0 )
   {
-    QPtrListIterator<SUIT_Operation> anIter( study()->operations() );
-    while( SUIT_Operation* anOp = anIter.current() )
+    QListIterator<SUIT_Operation*> anIter( study()->operations() );
+    while( anIter.hasNext() )
     {
-      if ( anOp->inherits( "LightApp_Operation" ) &&
+      SUIT_Operation* anOp = anIter.next();
+          
+      if ( anOp &&
+           anOp->inherits( "LightApp_Operation" ) &&
            ((LightApp_Operation*)anOp)->dlg() == aDlg )
         return ((LightApp_Operation*)anOp);
-      ++anIter;
-   }
+    }
   }
 
   return 0;
@@ -129,9 +135,8 @@ bool LightApp_SwitchOp::eventFilter( QObject* theObj, QEvent* theEv )
           if ( !anOp->isActive() && anOp->isAutoResumed() &&
                study() && !study()->blockingOperation( anOp ) )
             study()->resume( anOp );
+          break;
         }
-        break;
-        
         case QEvent::MouseButtonRelease:
         case QEvent::MouseButtonPress:
         case QEvent::MouseButtonDblClick:
@@ -141,9 +146,10 @@ bool LightApp_SwitchOp::eventFilter( QObject* theObj, QEvent* theEv )
         {
           if ( !anOp->isActive() )
             return true;
+          break;
         }
-        break;
-        
+        default:
+          break;
       }
     }
   }