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

Improving the resizing by dragging of the render window of the image dispalay plugin #1619

Open
wants to merge 13 commits into
base: melodic-devel
Choose a base branch
from
1 change: 1 addition & 0 deletions src/rviz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ add_library(${PROJECT_NAME}
tool_properties_panel.cpp
yaml_config_reader.cpp
yaml_config_writer.cpp
image_render_panel.cpp

${ENV_CONFIG_FILE}
)
Expand Down
4 changes: 2 additions & 2 deletions src/rviz/default_plugin/image_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#include "rviz/display_context.h"
#include "rviz/frame_manager.h"
#include "rviz/render_panel.h"
#include "rviz/image_render_panel.h"
#include "rviz/validate_floats.h"

#include <sensor_msgs/image_encodings.h>
Expand Down Expand Up @@ -115,7 +115,7 @@ void ImageDisplay::onInitialize()
img_scene_node_->attachObject(screen_rect_);
}

render_panel_ = new RenderPanel();
render_panel_ = new ImageRenderPanel();
render_panel_->getRenderWindow()->setAutoUpdated(false);
render_panel_->getRenderWindow()->setActive(false);

Expand Down
4 changes: 2 additions & 2 deletions src/rviz/default_plugin/image_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include "rviz/image/image_display_base.h"
#include "rviz/image/ros_image_texture.h"
#include "rviz/render_panel.h"
#include "rviz/image_render_panel.h"

#include "rviz/properties/bool_property.h"
#include "rviz/properties/float_property.h"
Expand Down Expand Up @@ -86,7 +86,7 @@ public Q_SLOTS:

ROSImageTexture texture_;

RenderPanel* render_panel_;
ImageRenderPanel* render_panel_;

private:
void clear();
Expand Down
27 changes: 27 additions & 0 deletions src/rviz/image_render_panel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "image_render_panel.h"

namespace rviz
{
ImageRenderPanel::ImageRenderPanel(QWidget* parent) : RenderPanel(parent)
{
}

ImageRenderPanel::~ImageRenderPanel()
{
}

void ImageRenderPanel::mouseMoveEvent(QMouseEvent* event)
{
QWidget::mouseMoveEvent(event);
}

void ImageRenderPanel::mousePressEvent(QMouseEvent* event)
{
QWidget::mousePressEvent(event);
}

void ImageRenderPanel::mouseReleaseEvent(QMouseEvent* event)
{
QWidget::mouseReleaseEvent(event);
}
} // namespace rviz
20 changes: 20 additions & 0 deletions src/rviz/image_render_panel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef RVIZ_IMAGE_RENDER_PANEL_H
#define RVIZ_IMAGE_RENDER_PANEL_H

#include "rviz/render_panel.h"
namespace rviz
{
class ImageRenderPanel : public RenderPanel
{
public:
ImageRenderPanel(QWidget* parent = nullptr);
~ImageRenderPanel() override;

protected:
void mouseMoveEvent(QMouseEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
};
} // namespace rviz

#endif // RVIZ_IMAGE_RENDER_PANEL_H