
Originally Posted by
baray98
Hello,
I am using QwtPlotSpectrogram with contour mode on and QwtPicker in a Plot. I noticed that when I have my contour ON my picker (showing tracker text) is slow compare to contour mode OFF. It seems like "drawing the contour lines" is called many times even my data has not changed at all. I believe QwtPicker is using some sort of qwtoverlay widget to minimize redrawing.
Now, Did I miss any cache setting for Contour mode? How can I make my picker as responsive as contour mode OFF in my spectrogram?
baray98
My hunch was right about my problem QwtRasterData::contourLines was called many times when my picker is enabled. Thus producing a performance hit. So my quick solution is to override contourLines and make a cache out from the rect and levels.
const QList<double> &levels, ConrecFlags flags ) const override
{
if (p_data->m_contourRect == rect && p_data->m_contourLevels == levels)
return p_data->m_contourLinesCache;
p_data->m_contourRect = rect;
p_data->m_contourLevels = levels;
p_data
->m_contourLinesCache
= QwtRasterData::contourLines(rect,raster,levels,flags
);
return p_data->m_contourLinesCache;
}
QwtRasterData::ContourLines Raster2D::contourLines(
const QRectF &rect, const QSize &raster,
const QList<double> &levels, ConrecFlags flags ) const override
{
if (p_data->m_contourRect == rect && p_data->m_contourLevels == levels)
return p_data->m_contourLinesCache;
p_data->m_contourRect = rect;
p_data->m_contourLevels = levels;
p_data->m_contourLinesCache = QwtRasterData::contourLines(rect,raster,levels,flags);
return p_data->m_contourLinesCache;
}
To copy to clipboard, switch view to plain text mode
things are quick and fast again.
baray98
Bookmarks