Ensure bins per pixel sanity in manipulator

Clamp the low bound of the bins per pixel value to 1 in the manipulator, not later on, by which time it’s already too late.
This commit is contained in:
Allan Bazinet 2024-09-12 13:12:44 -07:00
parent 91cf199083
commit 3925440507

View file

@ -478,8 +478,6 @@ CPlotter::DrawOverlayScale(double const df,
p.setPen(Qt::black);
p.drawRect(0, 0, m_w, 30);
if (m_binsPerPixel < 1) m_binsPerPixel = 1;
std::size_t const hdivs = m_w * df / m_freqPerDiv + 0.9999;
int f = ((m_startFreq + m_freqPerDiv - 1) / m_freqPerDiv) * m_freqPerDiv;
double const xOffset = float(f - m_startFreq) / m_freqPerDiv;
@ -685,7 +683,7 @@ void CPlotter::UpdateOverlay() //UpdateOverlay
void CPlotter::setBinsPerPixel(int const n) //setBinsPerPixel
{
m_binsPerPixel = n;
m_binsPerPixel = n < 1 ? 1 : n;
DrawOverlay(); //Redraw scales and ticks
update(); //trigger a new paintEvent}
}