}
+//----------------------------------------------------------------------------
+void
+SVTK_RenderWindowInteractor
+::contextMenuEvent( QContextMenuEvent* event )
+{
+ if( !( event->state() & KeyButtonMask ) )
+ emit contextMenuRequested( event );
+}
+
+
//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
( event->state() & ControlButton ),
( event->state() & ShiftButton ) );
myInteractor->MouseMoveEvent();
+
+ emit MouseMove( event );
}
myInteractor->MiddleButtonPressEvent();
else if( event->button() & RightButton )
myInteractor->RightButtonPressEvent();
+
+ emit MouseButtonPressed( event );
}
myInteractor->MiddleButtonReleaseEvent();
else if( event->button() & RightButton )
myInteractor->RightButtonReleaseEvent();
+
+ emit MouseButtonReleased( event );
}
void
SVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
-{}
+{
+ emit MouseDoubleClicked( event );
+}
//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
-{}
+{
+ emit WheelMoved( event );
+}
//----------------------------------------------------------------------------
( event->state() & ShiftButton ),
0 );
myInteractor->KeyPressEvent();
+
+ emit KeyPressed( event );
}
//----------------------------------------------------------------------------
( event->state() & ShiftButton ),
0 );
myInteractor->KeyReleaseEvent();
-}
-
-//----------------------------------------------------------------------------
-bool
-SVTK_RenderWindowInteractor
-::x11Event( XEvent *xEvent )
-{
- // handle 3d space mouse events
- SVTK_SpaceMouse* sm = SVTK_SpaceMouse::getInstance();
- if ( sm->isSpaceMouseOn() && xEvent->type == ClientMessage ) {
- SVTK_SpaceMouse::MoveEvent spaceMouseEvent;
- int type = sm->translateEvent( x11Display(), xEvent, &spaceMouseEvent, 1.0, 1.0 );
- switch ( type )
- {
- case SVTK_SpaceMouse::SpaceMouseMove :
- myInteractor->InvokeEvent( SpaceMouseMoveEvent, spaceMouseEvent.data );
- break;
- case SVTK_SpaceMouse::SpaceButtonPress :
- myInteractor->InvokeEvent( SpaceMouseButtonEvent, &spaceMouseEvent.button );
- break;
- case SVTK_SpaceMouse::SpaceButtonRelease :
- break;
- }
- return true; // stop handling the event
- }
-
- return SVTK_RenderWindow::x11Event( xEvent );
+ emit KeyReleased( event );
}
+
//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
}
else
SVTK_SpaceMouse::getInstance()->setWindow( x11Display(), winId() );
+
+ myInteractor->EnterEvent();
}
//----------------------------------------------------------------------------
// unregister set space mouse events receiver
if ( SVTK_SpaceMouse::getInstance()->isSpaceMouseOn() )
SVTK_SpaceMouse::getInstance()->setWindow( x11Display(), 0 );
+
+ myInteractor->LeaveEvent();
}
//----------------------------------------------------------------------------
-void
+bool
SVTK_RenderWindowInteractor
-::contextMenuEvent( QContextMenuEvent* event )
+::x11Event( XEvent *xEvent )
{
- if( !( event->state() & KeyButtonMask ) )
- emit contextMenuRequested( event );
-}
+ // handle 3d space mouse events
+ SVTK_SpaceMouse* sm = SVTK_SpaceMouse::getInstance();
+ if ( sm->isSpaceMouseOn() && xEvent->type == ClientMessage ) {
+ SVTK_SpaceMouse::MoveEvent spaceMouseEvent;
+ int type = sm->translateEvent( x11Display(), xEvent, &spaceMouseEvent, 1.0, 1.0 );
+ switch ( type )
+ {
+ case SVTK_SpaceMouse::SpaceMouseMove :
+ myInteractor->InvokeEvent( SpaceMouseMoveEvent, spaceMouseEvent.data );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonPress :
+ myInteractor->InvokeEvent( SpaceMouseButtonEvent, &spaceMouseEvent.button );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonRelease :
+ break;
+ }
+ return true; // stop handling the event
+ }
+ return SVTK_RenderWindow::x11Event( xEvent );
+}
//----------------------------------------------------------------------------
int
virtual void paintEvent( QPaintEvent* );
virtual void resizeEvent( QResizeEvent* );
+ virtual void contextMenuEvent( QContextMenuEvent * e );
virtual void mouseMoveEvent( QMouseEvent* );
virtual void mousePressEvent( QMouseEvent* );
virtual void keyPressEvent( QKeyEvent* );
virtual void keyReleaseEvent( QKeyEvent* );
- virtual bool x11Event( XEvent *e );
// reimplemented from QWidget in order to set window - receiver
// of space mouse events.
virtual void focusInEvent ( QFocusEvent* );
virtual void focusOutEvent( QFocusEvent* );
- virtual void contextMenuEvent( QContextMenuEvent * e );
+ virtual bool x11Event( XEvent *e );
+ public:
signals:
+ void MouseMove( QMouseEvent* );
+ void MouseButtonPressed( QMouseEvent* );
+ void MouseButtonReleased( QMouseEvent* );
+ void MouseDoubleClicked( QMouseEvent* );
+ void WheelMoved( QWheelEvent* );
+ void ButtonPressed(const QMouseEvent *event);
+ void ButtonReleased(const QMouseEvent *event);
+ void KeyPressed( QKeyEvent* );
+ void KeyReleased( QKeyEvent* );
void contextMenuRequested( QContextMenuEvent *e );
public:
-
/* Selection Management */
bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject);
bool isVisible( const Handle(SALOME_InteractiveObject)& IObject);
myView->setFocusPolicy( StrongFocus );
myView->setFocus();
+ connect( myView, SIGNAL(KeyPressed( QKeyEvent* )),
+ this, SLOT(onKeyPressed( QKeyEvent* )) );
+ connect( myView, SIGNAL(KeyReleased( QKeyEvent* )),
+ this, SLOT(onKeyReleased( QKeyEvent* )) );
+ connect( myView, SIGNAL(MouseButtonPressed( QMouseEvent* )),
+ this, SLOT(onMousePressed( QMouseEvent* )) );
+ connect( myView, SIGNAL(MouseButtonReleased( QMouseEvent* )),
+ this, SLOT(onMouseReleased( QMouseEvent* )) );
+ connect( myView, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
+ this, SLOT(onMouseDoubleClicked( QMouseEvent* )) );
+ connect( myView, SIGNAL(MouseMove( QMouseEvent* )),
+ this, SLOT(onMouseMoving( QMouseEvent* )) );
connect( myView, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
- this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+ this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
onResetView();