PDA

View Full Version : QwtSpectrogram contour ON a bit slow



baray98
8th May 2021, 03:10
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

baray98
9th May 2021, 00:29
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.



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,fla gs);

return p_data->m_contourLinesCache;
}



things are quick and fast again.
baray98

Uwe
10th May 2021, 07:31
There is no reason, why the plot should run into updates only because of using a picker ?

Uwe