Extending a QT aplication with ROS
Hi!
I have a QT application for a project. Now, this has to be integrated with ROS. My idea was to create a derived class of my QT widget and connect the signal from my widget to a function that will publish the ROS message that I want. Is this the right way to do it? Is there any place I can find an example of such thing?
In my QT widget I have the following:
class CameraDisplay : public QMainWindow
{
Q_OBJECT
public:
explicit CameraDisplay(QWidget *parent = 0){};
...// Other functions and methods
signals:
void newImage(cv::Mat image);
}
Then, I do not know if I have to derive it as
class ROSCameraDisplay: public CameraDisplay{
Q_OBJECT
public:
ROSCameraDisplay():{
connect(CameraDisplay,SIGNAL(newImage(cv::Mat)),this,SLOT(publish(cv::Mat)));
}
....//Other functions
private slots:
void publish(cv::Mat img);
or as
class ROSCameraDisplay: public CameraDisplay{
Q_OBJECT
public:
ROSCameraDisplay(QWidget* parent): QMainWindow(parent){
connect(CameraDisplay,SIGNAL(newImage(cv::Mat)),this,SLOT(publish(cv::Mat)));
}
....//Other functions
private slots:
void publish(cv::Mat img);
In the first case, I get that the vtable for ROSCameraDisplay is undefined. In the second one, I get that QMainWindow is not a direct base of ROSCamDisplay.
I have read about the vtable problem and I know that I get this error because there is some virtual function not instantiated. Does anybody know if there is a way to actually know for which function does it happens? As you can see in the CameraDisplay class, I have no virtual methods and I can instantiate the CameraDisplay class and use the QT interface in another program that only runs this GUI interface.