From 44a8b038f5587600559f94e66d566abf279ec374 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> Date: Sat, 10 Aug 2024 05:30:06 +0200 Subject: [PATCH] Fix #5851: Implement `EffectRackView::sizeHint()` (#7428) * Fix #5851: Implement `EffectRackView::sizeHint()` This fixes `EffectRackView` to have a permanent size hint instead of resizing the widget once in `InstrumentTrackWindow`. The size hint tells the `InstrumentTrackWindow` to not increase with a growing number of effects in the `EffectRackView`. --- include/EffectRackView.h | 2 ++ src/gui/EffectRackView.cpp | 9 +++++++++ src/gui/instrument/InstrumentTrackWindow.cpp | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/EffectRackView.h b/include/EffectRackView.h index 4a90c6b7a..fec627a56 100644 --- a/include/EffectRackView.h +++ b/include/EffectRackView.h @@ -64,6 +64,8 @@ private slots: private: void modelChanged() override; + QSize sizeHint() const override; + QSize minimumSizeHint() const override { return sizeHint(); } inline EffectChain* fxChain() { diff --git a/src/gui/EffectRackView.cpp b/src/gui/EffectRackView.cpp index 478e117fe..eb8c6c43e 100644 --- a/src/gui/EffectRackView.cpp +++ b/src/gui/EffectRackView.cpp @@ -273,4 +273,13 @@ void EffectRackView::modelChanged() +QSize EffectRackView::sizeHint() const +{ + // Use the formula from InstrumentTrackWindow.cpp + return QSize{EffectRackView::DEFAULT_WIDTH, 254 /* INSTRUMENT_HEIGHT */ - 4 - 1}; +} + + + + } // namespace lmms::gui diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 8b868bb50..1c9c93a09 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -265,7 +265,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget->addTab(m_tuningView, tr("Tuning and transposition"), "tuning_tab", 5); adjustTabSize(m_ssView); adjustTabSize(instrumentFunctions); - m_effectView->resize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1); + // EffectRackView has sizeHint to be QSize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1) adjustTabSize(m_midiView); adjustTabSize(m_tuningView);