diff --git a/src/rviz/default_plugin/tools/interaction_tool.cpp b/src/rviz/default_plugin/tools/interaction_tool.cpp index 488446a876..9d6f4a0485 100644 --- a/src/rviz/default_plugin/tools/interaction_tool.cpp +++ b/src/rviz/default_plugin/tools/interaction_tool.cpp @@ -143,7 +143,7 @@ int InteractionTool::processMouseEvent(ViewportMouseEvent& event) bool need_selection_update = context_->getFrameCount() > last_selection_frame_count_; // We are dragging if a button was down and is still down - Qt::MouseButtons buttons = event.buttons_down & (Qt::LeftButton | Qt::RightButton | Qt::MidButton); + Qt::MouseButtons buttons = event.buttons_down & (Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); if (event.type == QEvent::MouseButtonPress) buttons &= ~event.acting_button; bool dragging = buttons != 0; diff --git a/src/rviz/render_panel.cpp b/src/rviz/render_panel.cpp index bf2925e63a..c52c018001 100644 --- a/src/rviz/render_panel.cpp +++ b/src/rviz/render_panel.cpp @@ -126,8 +126,13 @@ void RenderPanel::wheelEvent(QWheelEvent* event) int last_x = mouse_x_; int last_y = mouse_y_; +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + mouse_x_ = event->position().x(); + mouse_y_ = event->position().y(); +#else mouse_x_ = event->x(); mouse_y_ = event->y(); +#endif if (context_) { diff --git a/src/rviz/view_controller.cpp b/src/rviz/view_controller.cpp index 14b002b9ee..ba10eba23d 100644 --- a/src/rviz/view_controller.cpp +++ b/src/rviz/view_controller.cpp @@ -141,7 +141,7 @@ QString ViewController::formatClassId(const QString& class_id) QVariant ViewController::getViewData(int column, int role) const { - if (role == Qt::TextColorRole) + if (role == Qt::ForegroundRole) return QVariant(); if (is_active_) diff --git a/src/rviz/viewport_mouse_event.h b/src/rviz/viewport_mouse_event.h index 47195b40f8..849386fbed 100644 --- a/src/rviz/viewport_mouse_event.h +++ b/src/rviz/viewport_mouse_event.h @@ -73,9 +73,14 @@ class ViewportMouseEvent : panel(p) , viewport(vp) , type(e->type()) +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + , x(e->position().x()) + , y(e->position().y()) +#else , x(e->x()) , y(e->y()) - , wheel_delta(e->delta()) +#endif + , wheel_delta(e->angleDelta().y()) , acting_button(Qt::NoButton) , buttons_down(e->buttons()) , modifiers(e->modifiers()) @@ -93,7 +98,7 @@ class ViewportMouseEvent } bool middle() { - return buttons_down & Qt::MidButton; + return buttons_down & Qt::MiddleButton; } bool right() { @@ -121,7 +126,7 @@ class ViewportMouseEvent } bool middleUp() { - return type == QEvent::MouseButtonRelease && acting_button == Qt::MidButton; + return type == QEvent::MouseButtonRelease && acting_button == Qt::MiddleButton; } bool rightUp() { @@ -134,7 +139,7 @@ class ViewportMouseEvent } bool middleDown() { - return type == QEvent::MouseButtonPress && acting_button == Qt::MidButton; + return type == QEvent::MouseButtonPress && acting_button == Qt::MiddleButton; } bool rightDown() {