Hello,
I'm using qwtPlot and qwtPlotCurve to show diagrams that could be bigger than the video. I have cursors to move through the diagram. Y axis is the time axis and X axis is the amplitude of a signal. It is possible to control a zoom on the Y axis, increasing or reducing the size of the plot, specially on the Y axis.
For example having a curve of 3000 samples I use a 5000 points plot to show it. Everything works well in this case.
If I try to plot the same curve, with the same samples, on a bigger time scale, for example the curve of 3000 samples on a plot of 25000 points, i've got the errors:
QPainter::begin Paint device returned engine
== 0, type
: 2 QPainter::setClipRct: Painter not active
and so on.
QPainter::begin Paint device returned engine == 0, type: 2
QPainter::translate: Painter not active
QPainter::save: Painter not active
QPainter::setClipRct: Painter not active
and so on.
To copy to clipboard, switch view to plain text mode
I understood that could be a problem of QPixMap size not exactly defined, but I'm not able to find in the documentation in which way I can set it, because I don't use QPixmap explicitly but only through Qwt classes,
Or maybe is something different that I don't know.
This is the piece of my source code.
plot
->enableAxis
(QwtPlot::xBottom,
false);
plot
->enableAxis
(QwtPlot::yLeft,
false);
plot->setCanvasBackground(Qt::white);
plot
->setFrameStyle
(QFrame::NoFrame);
plot->setCanvasLineWidth(1);
plot
->setAxisScale
(QwtPlot::yLeft, samplesNumber,
0,
0);
plot
->axisScaleDraw
(QwtPlot::yLeft);
plot->setMaximumWidth(plotWidth);
plot->setMaximumHeight(plotHeight);
plotCurve->setOrientation(Qt::Horizontal);
plotCurve
->setPaintAttribute
(QwtPlotCurve::ClipPolygons,
true);
plotCurve->setSamples(amplitudeToShowValue[i], tValue);
plotCurve
->setPen
(QColor(Qt
::blue));
plotCurve
->setBrush
(QBrush(Qt
::blue, Qt
::SolidPattern));
plotCurve->setBaseline(0);
plotCurve->attach(plot);
QwtPlot * plot = new QwtPlot();
QwtPlotCurve * plotCurve = new QwtPlotCurve();
plot->enableAxis(QwtPlot::xBottom, false);
plot->enableAxis(QwtPlot::yLeft, false);
plot->setCanvasBackground(Qt::white);
plot->setFrameStyle(QFrame::NoFrame);
plot->setCanvasLineWidth(1);
plot->setAxisScale(QwtPlot::yLeft, samplesNumber, 0, 0);
plot->axisScaleDraw(QwtPlot::yLeft);
plot->setMaximumWidth(plotWidth);
plot->setMaximumHeight(plotHeight);
plotCurve->setOrientation(Qt::Horizontal);
plotCurve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);
plotCurve->setSamples(amplitudeToShowValue[i], tValue);
plotCurve->setPen(QColor(Qt::blue));
plotCurve->setBrush(QBrush(Qt::blue, Qt::SolidPattern));
plotCurve->setBaseline(0);
plotCurve->attach(plot);
To copy to clipboard, switch view to plain text mode
Thank you very much for any suggestion,
carlo
Bookmarks