::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);
}
+//----------------------------------------------------------------------------
+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
aSpaceMouse->setWindow(x11Display(),winId());
}
}
-
- GetDevice()->EnterEvent();
}
//----------------------------------------------------------------------------
if(aSpaceMouse->isSpaceMouseOn())
aSpaceMouse->setWindow(x11Display(),0);
}
-
- GetDevice()->LeaveEvent();
}
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
virtual bool x11Event( XEvent *e );
+ QWidget* myPreviousFocusWidget;
vtkSmartPointer<vtkRenderWindow> myRenderWindow;
vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
};