Hello.
How can i get painter of QwtPlot, QwtPlotCanvas?
I try to do like:
QLine line(pos.x() - 5, canvas()->rect().bottom(), pos.x() - 5, canvas()->rect().top());
1st method:
QPainter *painter = new QPainter(const_cast<QwtPlotCanvas *>(canvas()));
painter->save();
painter->setPen(Qt::blue);
painter->drawLine(line);
painter->restore();
2d method:
QPainter *p = plot()->paintEngine()->painter();
p->drawLine(line);
3d method:
// canvas()->paintEngine()->drawLines(&line, 1);
QPaintEngine *pe = canvas()->paintEngine();
pe->drawLines(&line, 1);
There is no one work. Why?
And how than I need to draw some line (not QwtPlotCurve) at QwtPlot?
Bookmarks