PDA

View Full Version : Sublcassing QwtPlotItem to customize its drawing behaviour



corrado1972
16th March 2011, 10:05
I don't know if my trouble is properly related to Qwt or widely to c++ :o

How do I override draw method of an item (curve, marker) for customize its drawing behaviour ?

I tried with this code, but I can't take the control of overrided draw method, seems that compiler is ignoring it:

This is the code that is not working:


class train_evt_marker: public QwtPlotMarker
{
public:
train_evt_marker():QwtPlotMarker()
{
// here I see this log message
QLOG_TRACE()<<"-------------constructor MARKER-------------";
}

void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect)
{
// here I can't see the log messages... is this overrided method ignored??
QLOG_TRACE()<<"-------------DRAw MARKER-------------";
// calling the parent method continuing the draw of the curve
QwtPlotMarker::draw(painter,xMap,yMap,canvasRect);
}
};

TIA

Uwe
16th March 2011, 18:53
Wrong signature of train_evt_marker::draw( ... ) - the const is missing.

Uwe