From f405a25d7423231a8876925bfb044cc2bb7e239e Mon Sep 17 00:00:00 2001 From: Allan Bazinet Date: Thu, 7 Nov 2024 19:04:55 -0800 Subject: [PATCH] Compute height directly in drawFilter() --- plotter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plotter.cpp b/plotter.cpp index 8e5ab66b..8e27e058 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -530,18 +530,19 @@ CPlotter::drawFilter() p.setCompositionMode(QPainter::CompositionMode_Source); - auto const start = xFromFreq(static_cast(m_filterCenter - m_filterWidth / 2)); - auto const end = xFromFreq(static_cast(m_filterCenter + m_filterWidth / 2)); + auto const height = size().height(); + auto const start = xFromFreq(static_cast(m_filterCenter - m_filterWidth / 2)); + auto const end = xFromFreq(static_cast(m_filterCenter + m_filterWidth / 2)); // Remove the bandpass from the filter. - p.fillRect(start, 0, end - start, m_h, Qt::transparent); + p.fillRect(start, 0, end - start, height, Qt::transparent); // Yellow vertical lines, showing the filter edges. p.setPen(Qt::yellow); - p.drawLine(start, 30, start, m_h); - p.drawLine(end, 30, end, m_h); + p.drawLine(start, 30, start, height); + p.drawLine(end, 30, end, height); } }