30 #include <QApplication> 34 #include <OgreSceneManager.h> 35 #include <OgreCamera.h> 54 , view_controller_( 0 )
55 , context_menu_visible_(false)
56 , fake_mouse_move_event_timer_( new QTimer() )
59 setFocus( Qt::OtherFocusReason );
83 ss <<
"RenderPanelCamera" << count++;
97 QPoint cursor_pos = QCursor::pos();
98 QPoint mouse_rel_widget = mapFromGlobal( cursor_pos );
99 if( rect().contains( mouse_rel_widget ))
101 bool mouse_over_this =
false;
102 QWidget *
w = QApplication::widgetAt( cursor_pos );
107 mouse_over_this =
true;
110 w = w->parentWidget();
112 if( !mouse_over_this )
117 QMouseEvent fake_event( QEvent::MouseMove,
120 QApplication::mouseButtons(),
121 QApplication::keyboardModifiers() );
127 setCursor( Qt::ArrowCursor );
144 setFocus( Qt::MouseFocusReason );
162 setFocus( Qt::MouseFocusReason );
199 QApplication::postEvent(
this,
new QContextMenuEvent( QContextMenuEvent::Mouse, QPoint() ));
222 connect( context_menu.get(), SIGNAL( aboutToHide() ),
this, SLOT(
onContextMenuHide() ) );
223 context_menu->exec( QCursor::pos() );
virtual void keyPressEvent(QKeyEvent *event)
virtual void setStatus(const QString &message)=0
ViewController * view_controller_
virtual void handleMouseEvent(const ViewportMouseEvent &event)=0
Handle a mouse event.
void initialize(Ogre::SceneManager *scene_manager, DisplayContext *manager)
void sendMouseMoveEvent()
void setViewController(ViewController *controller)
Set the ViewController which should control the camera position for this view.
void showContextMenu(boost::shared_ptr< QMenu > menu)
bool context_menu_visible_
virtual void handleChar(QKeyEvent *event, RenderPanel *panel)=0
Handle a single key event for a given RenderPanel.
Ogre::SceneManager * scene_manager_
void onRenderWindowMouseEvents(QMouseEvent *event)
Called when any mouse event happens inside the render window.
Pure-virtual base class for objects which give Display subclasses context in which to work...
bool contextMenuVisible()
int mouse_y_
Y position of the last mouse event.
Ogre::Camera * getCamera() const
DisplayContext * context_
QTimer * fake_mouse_move_event_timer_
int mouse_x_
X position of the last mouse event.
TFSIMD_FORCE_INLINE const tfScalar & w() const
virtual void sceneManagerDestroyed(Ogre::SceneManager *source)
Ogre::Viewport * getViewport() const
boost::shared_ptr< QMenu > context_menu_
virtual void wheelEvent(QWheelEvent *event)
Called when there is a mouse-wheel event.
void activate()
Called by RenderPanel when this view controller is about to be used.
void setCamera(Ogre::Camera *camera)
virtual void leaveEvent(QEvent *event)
boost::mutex context_menu_mutex_
Ogre::Camera * default_camera_
A default camera created in initialize().
void contextMenuEvent(QContextMenuEvent *event)
RenderPanel(QWidget *parent=0)