]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for Bug GVIEW10162
authorapo <apo@opencascade.com>
Thu, 6 Oct 2005 08:33:00 +0000 (08:33 +0000)
committerapo <apo@opencascade.com>
Thu, 6 Oct 2005 08:33:00 +0000 (08:33 +0000)
Dynamic rotation and panning are working by different way in compare with described in specification

src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_RenderWindowInteractor.h

index 74a930ab0ed06181ba0be313b311fb8ff2e97bca..30117c8f8f13ba474418f6bb8c3d2ae8cab9284b 100644 (file)
@@ -76,7 +76,8 @@ QVTK_RenderWindowInteractor
 ::QVTK_RenderWindowInteractor(QWidget* theParent, 
                              const char* theName):
   QWidget(theParent,theName),
-  myRenderWindow(vtkRenderWindow::New())
+  myRenderWindow(vtkRenderWindow::New()),
+  myPreviousFocusWidget(NULL)
 {
   if(MYDEBUG) INFOS("QVTK_RenderWindowInteractor() - "<<this);
   setMouseTracking(true);
@@ -311,6 +312,31 @@ QVTK_RenderWindowInteractor
 }
 
 
+//----------------------------------------------------------------------------
+void  
+QVTK_RenderWindowInteractor
+::enterEvent( QEvent* event )
+{
+  if(qApp->focusWidget() != this)
+    myPreviousFocusWidget = qApp->focusWidget();
+
+  QWidget::setFocus();
+
+  GetDevice()->EnterEvent();
+}
+
+//----------------------------------------------------------------------------
+void  
+QVTK_RenderWindowInteractor
+::leaveEvent( QEvent * )
+{
+  if(myPreviousFocusWidget)
+    myPreviousFocusWidget->setFocus();
+
+  GetDevice()->LeaveEvent();
+}
+
+
 //----------------------------------------------------------------------------
 void  
 QVTK_RenderWindowInteractor
@@ -326,8 +352,6 @@ QVTK_RenderWindowInteractor
       aSpaceMouse->setWindow(x11Display(),winId());
     }
   }
-
-  GetDevice()->EnterEvent();
 }
 
 //----------------------------------------------------------------------------
@@ -342,8 +366,6 @@ QVTK_RenderWindowInteractor
     if(aSpaceMouse->isSpaceMouseOn())
       aSpaceMouse->setWindow(x11Display(),0);
   }
-
-  GetDevice()->LeaveEvent();
 }
 
 
index 717c81a0d5d609b4b78082759e324649ed1ebb8d..acfabc3a42ab942f151d75e5819f1696af548aa9 100644 (file)
@@ -87,6 +87,9 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget
   virtual void wheelEvent( QWheelEvent* );
   virtual void keyPressEvent( QKeyEvent* );
   virtual void keyReleaseEvent( QKeyEvent* );
+  virtual void enterEvent( QEvent * );
+  virtual void leaveEvent( QEvent * );
+
   virtual void contextMenuEvent( QContextMenuEvent * e );
 
   // reimplemented from QWidget in order to set window - receiver
@@ -96,6 +99,7 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget
 
   virtual bool x11Event( XEvent *e );
 
+  QWidget* myPreviousFocusWidget;
   vtkSmartPointer<vtkRenderWindow> myRenderWindow;
   vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
 };