I'm adding more information for clarity
How can I attach an image file, pix1.JPG, to QwtPlot as if it's a QwtPlotCurve so that I'll get to use the axis, legend, selection, zoom, etc ... see the attached image3.JPG
It seems that subclassing QwtPlotRasterItem, but I must haven't written the renderImage method correctly
const QwtScaleMap &yMap,
const QwtDoubleRect
&area
) const {
if ( area.isEmpty() )
QRect rect
= transform
(xMap, yMap, area
);
QPixmap pixmap
(rect.
width(), rect.
height());
pixmap.load(_filename);
return pixmap.toImage();
}
QImage OverlayImagePlot::renderImage(const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QwtDoubleRect &area) const
{
if ( area.isEmpty() )
return QImage();
QRect rect = transform(xMap, yMap, area);
QPixmap pixmap(rect.width(), rect.height());
pixmap.load(_filename);
return pixmap.toImage();
}
To copy to clipboard, switch view to plain text mode
Two problems that I'm facing:
1) the grid is drawn on top of the image, see pix4.JPG
2) when drawing this pix1.JPG on top of a QwtPlot that already contains a red standard curve and a blue custom rectangle [as in pix2.JPG snapshot] results in a very strange behavior: the red standard curve draws fine, but the blue custom rectangle disappeared (or being drawn behind the image) , pix3.JPG
Bookmarks