From: apo Date: Thu, 6 Oct 2005 08:33:00 +0000 (+0000) Subject: Fix for Bug GVIEW10162 X-Git-Tag: BR-D5-38-2003_D2005-12-10~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c30abad1deeb9129df19544371124a0c83b0642;p=modules%2Fgui.git Fix for Bug GVIEW10162 Dynamic rotation and panning are working by different way in compare with described in specification --- diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 74a930ab0..30117c8f8 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -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() - "<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(); } diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index 717c81a0d..acfabc3a4 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -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 myRenderWindow; vtkSmartPointer myDevice; };