here is my code:
MyPicker.h
{
public:
MyPicker
( int xAxis
= QwtPlot::xBottom,
RubberBand rubberBand = CrossRubberBand,
DisplayMode trackerMode
= QwtPicker::AlwaysOn,
void selectPoint
( const QPointF & point
);
void highlightPoint( bool isHightlight );
public slots:
// slot for SIGNAL --> void selected( const QPointF &pos )
void slotSelected
( const QPointF &pos
);
private:
int m_selectedPointIndex;
};
class MyPicker : public QwtPlotPicker
{
public:
MyPicker( QwtPlot *plot );
MyPicker( int xAxis = QwtPlot::xBottom,
int yAxis = QwtPlot::yLeft,
RubberBand rubberBand = CrossRubberBand,
DisplayMode trackerMode = QwtPicker::AlwaysOn,
QwtPlot *plot = NULL );
void selectPoint( const QPointF & point );
void highlightPoint( bool isHightlight );
public slots:
// slot for SIGNAL --> void selected( const QPointF &pos )
void slotSelected( const QPointF &pos);
private:
QwtPlot *m_pQwtPlot;
QwtPlotCurve *m_pSelectedCurve;
int m_selectedPointIndex;
};
To copy to clipboard, switch view to plain text mode
MyPicker.cpp
#include "mypicker.h"
MyPicker
::MyPicker(QwtPlot *plot
) : m_pSelectedCurve( NULL ),
m_pQwtPlot( plot ),
m_selectedPointIndex( -1 )
{
connect( this,
SIGNAL( selected
( const QPointF ) ),
this,
SLOT( slotSelected
( const QPointF ) ) );
}
...
#include "mypicker.h"
MyPicker::MyPicker(QwtPlot *plot) :
QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, CrossRubberBand, QwtPicker::AlwaysOn, plot->canvas()),
m_pSelectedCurve( NULL ),
m_pQwtPlot( plot ),
m_selectedPointIndex( -1 )
{
connect( this, SIGNAL( selected( const QPointF ) ), this, SLOT( slotSelected( const QPointF ) ) );
}
...
To copy to clipboard, switch view to plain text mode
the QtCreator shows error:
-----------------------------------------------------------------------------------------------------
QObject::connect: No such slot QwtPlotPicker::slotSelected( const QPointF ) in ..\ttt\mypicker.cpp:9
-----------------------------------------------------------------------------------------------------
I think the problem caused by that: SIGANL selected() defined in parent class, and SLOT slotSelected() defined in subclass.
So, how should fix the problem? Thank you in advance.
Bookmarks