Re: Sir, Find error in this code? Why am i not able to draw the symbols?
Code:
public:
void drawSymbols
(QPainter * painter,
const QPointF * point,
int numPoints
) const;
};
}
void Symbol
::drawSymbols(QPainter *painter,
const QPointF *point,
int numPoints
) const{ pixx->load(":/Images/AlarmEvent.png");
painter->drawPixmap(point,pixx);
}
// in constructor---->
Symbol *symb;
for(int i=0;i<yData_1.size();i++){
const QPointF point
(xData_1.
at(i
),yData_1.
at(i
));
symb
=new Symbol
(QwtSymbol::drawSymbols(pnt,
&point,
1));
mark_1[i]->setSymbol(symb);
mark_1[i]->setValue(xData_2.at(i),yData_2.at(i));
mark_1[i]->attach(plot);
}
Why am i not able to draw the symbol??????
error i am getting is : no matching function for call to 'QPainter::drawPixmap(const QPointF*&, QPixmap*&)'
E:\TempLog_Sonu1\TempLog\TempLogWidget.h:43: error: no matching function for call to 'QwtSymbol::QwtSymbol(QwtSymbol*&)'
Re: Sir, Find error in this code? Why am i not able to draw the symbols?
Whenever you see such error message, check that your pointers are ok...
You are trying to load the image file into an uninitialized pointer.
Try this
QPixmap pixx; // Make it a QPixmap, not a pointer to it. If you wish to have a pointer variable, you need to create the piix with 'new' operator
pixx.load(":/Images/AlarmEvent.png");
painter->drawPixmap(*point,pixx); // pass the point reference, not the pointer to it