ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hi Authur,
I managed to do that by using a QEventFilter on the plugin's widget object.
SamplePlugin.h:
class SamplePlugin : public rqt_gui_cpp::Plugin {
Q_OBJECT
public:
...
bool eventFilter(QObject *target, QEvent *event);
...
}
SamplePlugin.cpp:
...
void SamplePlugin::initPlugin(qt_gui_cpp::PluginContext &context) {
widget = new QWidget();
ui.setupUi(widget);
context.addWidget(widget);
widget->installEventFilter(this);
widget->setFocus();
...
}
...
bool SamplePlugin::eventFilter(QObject *target, QEvent *event) {
if(event->type() == QEvent::KeyPress)
std::cout << "Key pressed!" << std::endl;
return rqt_gui_cpp::Plugin::eventFilter(target, event);
}
...
I found this out on rover_gui_plugin.cpp on link text.
Asked: 2017-03-13 05:35:53 -0500
Seen: 454 times
Last updated: Jun 10 '17
I want make new GUI in the rqt (like c# or mfc)
how could create my own GUI to control my own robot
rosrun rqt_graph rqt_graph (Import error: no module named rospkg)(Is this is related to anaconda?)
RQt cant find RViz display types
Reply to service call using GUI (e.g. rqt)
When using rqt with Qt5, does not find <QObject> in ROS internal "plugin_bridge.h"
Kobuki error , Kobuki/Watchdog no signal in rqt. Kindly help me out !
rqt
provides a way to hook yourQt
programs to ROS. You should be able to handle QEvent and its child class events without any knowledge for ROS.