Hi all,
I have a problem that could be very stupid, but I'm not able to solve it.
I'm tring to be aware when an operator click with mouse on a qwtPlot, and have a class informed with a signal of the mouse position on the plot where he clicked.
These are the pieces of code.
Header:
#include <QMouseEvent>
#include <QDebug>
#include <qwt_plot.h>
{
public:
QwtPlotMy(int idPlotValue = 0);
signals:
void clickSignal();
private:
int idPlot;
};
#include <QMouseEvent>
#include <QDebug>
#include <qwt_plot.h>
class QwtPlotMy : public QwtPlot
{
public:
QwtPlotMy(int idPlotValue = 0);
signals:
void clickSignal();
private:
void mousePressEvent(QMouseEvent * event);
int idPlot;
};
To copy to clipboard, switch view to plain text mode
Cpp:
#include "qwtplotmy.h"
QwtPlotMy::QwtPlotMy(int idPlotValue) :
{
idPlot = idPlotValue;
return;
}
{
emit (clickSignal());
qDebug() << "Into qwtplot"<<idPlot;
qDebug() << "x"<< event->x() << " - y"<< event->y() ;
return;
}
#include "qwtplotmy.h"
QwtPlotMy::QwtPlotMy(int idPlotValue) :
QwtPlot()
{
idPlot = idPlotValue;
return;
}
void QwtPlotMy::mousePressEvent(QMouseEvent * event)
{
emit (clickSignal());
qDebug() << "Into qwtplot"<<idPlot;
qDebug() << "x"<< event->x() << " - y"<< event->y() ;
return;
}
To copy to clipboard, switch view to plain text mode
The problem is: compiling I get the message error:
undefined reference to 'QwtPlotMy::clickSignal()'
undefined reference to 'QwtPlotMy::clickSignal()'
To copy to clipboard, switch view to plain text mode
If I comment the "emit (clickSignal())" line everything works well and I have the mouse position in the debug messages. Where I missed something?
Thank you very much in advance,
Carlo
Bookmarks