Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse move #1433

Merged
merged 2 commits into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/rviz/render_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ RenderPanel::RenderPanel( QWidget* parent )
, scene_manager_( 0 )
, view_controller_( 0 )
, context_menu_visible_(false)
//TODO(simonschmeisser) remove this in noetic
, fake_mouse_move_event_timer_( new QTimer() )
, default_camera_(0)
{
setFocusPolicy(Qt::WheelFocus);
setFocus( Qt::OtherFocusReason );
setMouseTracking(true);
}

RenderPanel::~RenderPanel()
{
//TODO(simonschmeisser) remove this in noetic
delete fake_mouse_move_event_timer_;
if( scene_manager_ && default_camera_ )
{
Expand All @@ -89,11 +92,9 @@ void RenderPanel::initialize(Ogre::SceneManager* scene_manager, DisplayContext*
default_camera_->lookAt(0, 0, 0);

setCamera( default_camera_ );

connect( fake_mouse_move_event_timer_, SIGNAL( timeout() ), this, SLOT( sendMouseMoveEvent() ));
fake_mouse_move_event_timer_->start( 33 /*milliseconds*/ );
}

//TODO(simonschmeisser) remove this in noetic
void RenderPanel::sendMouseMoveEvent()
{
QPoint cursor_pos = QCursor::pos();
Expand Down Expand Up @@ -124,6 +125,7 @@ void RenderPanel::sendMouseMoveEvent()
onRenderWindowMouseEvents( &fake_event );
}
}

void RenderPanel::leaveEvent ( QEvent * event )
{
setCursor( Qt::ArrowCursor );
Expand Down
2 changes: 2 additions & 0 deletions src/rviz/render_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ Q_OBJECT
Display* display_;

private Q_SLOTS:
//TODO(simonschmeisser) remove this in noetic
void sendMouseMoveEvent();
void onContextMenuHide();

private:
//TODO(simonschmeisser) remove this in noetic
QTimer* fake_mouse_move_event_timer_;
Ogre::Camera* default_camera_; ///< A default camera created in initialize().
};
Expand Down