From 30f028d1bf5a4cb3ba429061823135ba6b394ca9 Mon Sep 17 00:00:00 2001 From: Alberto Tudela Date: Fri, 28 Jun 2024 21:59:21 +0200 Subject: [PATCH] Fix logo in nav2 panel (#4505) * Fix logo in nav2 panel Signed-off-by: Alberto Tudela * Move icon Signed-off-by: Alberto Tudela --------- Signed-off-by: Alberto Tudela --- .../icons/classes}/nav2_logo_small.png | Bin .../include/nav2_rviz_plugins/nav2_panel.hpp | 1 - nav2_rviz_plugins/src/nav2_panel.cpp | 5 +++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename {doc => nav2_rviz_plugins/icons/classes}/nav2_logo_small.png (100%) diff --git a/doc/nav2_logo_small.png b/nav2_rviz_plugins/icons/classes/nav2_logo_small.png similarity index 100% rename from doc/nav2_logo_small.png rename to nav2_rviz_plugins/icons/classes/nav2_logo_small.png diff --git a/nav2_rviz_plugins/include/nav2_rviz_plugins/nav2_panel.hpp b/nav2_rviz_plugins/include/nav2_rviz_plugins/nav2_panel.hpp index 064c6c68ff..ce4212a4b8 100644 --- a/nav2_rviz_plugins/include/nav2_rviz_plugins/nav2_panel.hpp +++ b/nav2_rviz_plugins/include/nav2_rviz_plugins/nav2_panel.hpp @@ -178,7 +178,6 @@ private Q_SLOTS: QState * paused_wp_{nullptr}; QState * resumed_wp_{nullptr}; - QImage * image_{nullptr}; QLabel * imgDisplayLabel_{nullptr}; // The following states are added to allow for the state of the button to only expose reset diff --git a/nav2_rviz_plugins/src/nav2_panel.cpp b/nav2_rviz_plugins/src/nav2_panel.cpp index 64ba0a329b..a3742685f3 100644 --- a/nav2_rviz_plugins/src/nav2_panel.cpp +++ b/nav2_rviz_plugins/src/nav2_panel.cpp @@ -30,6 +30,7 @@ #include "nav2_rviz_plugins/goal_common.hpp" #include "nav2_rviz_plugins/utils.hpp" #include "rviz_common/display_context.hpp" +#include "rviz_common/load_resource.hpp" #include "ament_index_cpp/get_package_share_directory.hpp" #include "yaml-cpp/yaml.h" #include "geometry_msgs/msg/pose2_d.hpp" @@ -523,9 +524,9 @@ Nav2Panel::Nav2Panel(QWidget * parent) QVBoxLayout * group_box_layout = new QVBoxLayout; QGroupBox * groupBox = new QGroupBox(tr("Tools for WP-Following")); - image_ = new QImage("src/navigation2/doc/nav2_logo_small.png"); imgDisplayLabel_ = new QLabel(""); - imgDisplayLabel_->setPixmap(QPixmap::fromImage(*image_)); + imgDisplayLabel_->setPixmap( + rviz_common::loadPixmap("package://nav2_rviz_plugins/icons/classes/nav2_logo_small.png")); status_layout->addWidget(navigation_status_indicator_); status_layout->addWidget(localization_status_indicator_);