ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Add a QPanel to rviz

asked 2018-12-13 09:57:46 -0500

Kapcirt gravatar image

updated 2018-12-13 10:04:38 -0500

Hello everyone,

I want to add 2 buttons on my rviz to be able to control the 'dock' and 'undock' control from the GUI. So I followed this tutorial to create the panel. But when I try to build it it give me the error

QPainter: No such file or directory #include QPainter

Here is my Cpp file : #include <stdio.h>

#include <QPainter>
#include <QHBoxLayout>
#include <QTimer>
#include <QPushButton>

#include "keylo_rviz_panel.h"

namespace keylo_rviz_plugin
    KeyloRvizPanel::KeyloRvizPanel(Qwidget* parent) 
        : rviz::Panel( parent )
            QHBoxLayout* layout = new QHBoxLayout;
            undock_button = new QPushButton("Undock Robot");
            dock_button = new QPushButton("Dock Robot");


#include <pluginlib class_list_macros.h=""> PLUGINLIB_EXPORT_CLASS(keylo_rviz_plugin::KeyloRvizPanel, rviz::Panel ) Here is my CMakeLists.txt :

cmake_minimum_required(VERSION 2.8.3) project(keylo_rviz_plugin)

find_package(catkin REQUIRED COMPONENTS   roscpp   rospy   rviz   std_msgs )

catkin_package() include_directories(${catkin_INCLUDE_DIRS}) link_directories(${catkin_LIBRARY_DIRS})


include_directories(   include   ${catkin_INCLUDE_DIRS} )

add_library(keylo_rviz_panel src/keylo_rviz_panel)

Do yuou know why I can't import library from Qt ?

Thanks for your help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-14 04:08:37 -0500

Kapcirt gravatar image

updated 2018-12-14 04:09:31 -0500

Solved! I just needed to add these lines in my CMakeLists.txt

find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)

And install Qt4 with :

sudo apt-get install qt4-default
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-12-13 09:57:46 -0500

Seen: 382 times

Last updated: Dec 14 '18