Skip to content

Commit

Permalink
Fix Qt 5.15 API deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Sep 16, 2023
1 parent d560273 commit 0ff3191
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/rviz/default_plugin/tools/interaction_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/rviz/render_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ void RenderPanel::wheelEvent(QWheelEvent* event)
int last_x = mouse_x_;
int last_y = mouse_y_;

mouse_x_ = event->x();
mouse_y_ = event->y();
mouse_x_ = event->position().x();
mouse_y_ = event->position().y();

if (context_)
{
Expand Down
2 changes: 1 addition & 1 deletion src/rviz/view_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
12 changes: 6 additions & 6 deletions src/rviz/viewport_mouse_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class ViewportMouseEvent
: panel(p)
, viewport(vp)
, type(e->type())
, x(e->x())
, y(e->y())
, wheel_delta(e->delta())
, x(e->position().x())
, y(e->position().y())
, wheel_delta(e->angleDelta().y())
, acting_button(Qt::NoButton)
, buttons_down(e->buttons())
, modifiers(e->modifiers())
Expand All @@ -93,7 +93,7 @@ class ViewportMouseEvent
}
bool middle()
{
return buttons_down & Qt::MidButton;
return buttons_down & Qt::MiddleButton;
}
bool right()
{
Expand Down Expand Up @@ -121,7 +121,7 @@ class ViewportMouseEvent
}
bool middleUp()
{
return type == QEvent::MouseButtonRelease && acting_button == Qt::MidButton;
return type == QEvent::MouseButtonRelease && acting_button == Qt::MiddleButton;
}
bool rightUp()
{
Expand All @@ -134,7 +134,7 @@ class ViewportMouseEvent
}
bool middleDown()
{
return type == QEvent::MouseButtonPress && acting_button == Qt::MidButton;
return type == QEvent::MouseButtonPress && acting_button == Qt::MiddleButton;
}
bool rightDown()
{
Expand Down

0 comments on commit 0ff3191

Please sign in to comment.