diff --git a/src/VisualizerWidget.cpp b/src/VisualizerWidget.cpp index 101d308..4a411fa 100644 --- a/src/VisualizerWidget.cpp +++ b/src/VisualizerWidget.cpp @@ -384,9 +384,11 @@ void VisualizerWidget::render(QRhiCommandBuffer *cb) { int w = width(); int h = height(); - // Only rebuild vertices when new data has arrived - if (m_dataDirty) { + // Rebuild vertices when new data arrived or widget was resized + if (m_dataDirty || w != m_lastBuildW || h != m_lastBuildH) { m_dataDirty = false; + m_lastBuildW = w; + m_lastBuildH = h; if (m_mirrored) { buildVertices(w * 0.55f, h / 2); buildCepstrumVertices(w, h); diff --git a/src/VisualizerWidget.h b/src/VisualizerWidget.h index 86d9e69..1ae95ce 100644 --- a/src/VisualizerWidget.h +++ b/src/VisualizerWidget.h @@ -68,6 +68,8 @@ private: int m_targetFps = 60; qint64 m_lastFrameTime = 0; bool m_dataDirty = false; + int m_lastBuildW = 0; + int m_lastBuildH = 0; // RHI resources QRhi *m_rhi = nullptr;