tool_template.hpp
# ifndef SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP
# define SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP
# ifndef Q_MOC_RUN
# include <rclcpp/rclcpp.hpp>
# include <rviz_common/panel.hpp>
# include <QtWidgets>
# endif
namespace sample_rviz_plugins
{
class PanelTemplate : public rviz_common::Panel
{
Q_OBJECT
public:
PanelTemplate(QWidget *parent = nullptr);
virtual void onInitialize();
virtual void load(const rviz_common::Config &config);
virtual void save(rviz_common::Config config) const;
protected:
QHBoxLayout *layout_;
// QPushButton* button_;
};
}
# endif // SAMPLE_RVIZ_PLUGINS_PANEL_TEMPLATE_HPP
tool_template.cpp
# include "panel_template.hpp"
# include <rviz_common/config.hpp>
// #include <QVBoxLayout>
// #include <QHBoxLayout>
// #include <QSignalMapper>
// #include <rviz_common/display_context.hpp>
namespace sample_rviz_plugins
{
PanelTemplate::PanelTemplate(QWidget *parent)
: rviz_common::Panel(parent)
{
}
void PanelTemplate::onInitialize()
{
}
void PanelTemplate::save(rviz_common::Config config) const
{
rviz_common::Panel::save(config);
}
void PanelTemplate::load(const rviz_common::Config &config)
{
rviz_common::Panel::load(config);
}
}
# include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(sample_rviz_plugins::PanelTemplate, rviz_common::Panel)