PDA

View Full Version : Qwt: Unable to draw the label from qwtplotmarker?



sonulohani
1st June 2012, 06:56
Sir, this is my code:-
in .h file


class Marker:public QwtPlotMarker{


public:
virtual void drawLabel(QPainter *painter, const QRectF &, const QPointF &pt) const{
painter=new QPainter;
QImage pixx(":/Images/AlarmEvent.png");
QRectF r(1,1,10,10);
painter->drawImage(r,pixx);
}
};


in .cpp file



Marker *mark;
mark=new Marker;
mark->setValue(xData_1.at(0),yData_1.at(0));//this is where i want to place the marker.
mark->attach(plot);


Sir, it is not showing any label on the marker. Why is this happening? Is something wrong in the code? Please Guide Me.

sonulohani
1st June 2012, 14:55
This is wrong as i am creating an object of the QPainter. Sorry but now it is solved.