diff --git a/plugins/LadspaEffect/LadspaMatrixControlDialog.cpp b/plugins/LadspaEffect/LadspaMatrixControlDialog.cpp index 1ce1de53b..3384b6da0 100644 --- a/plugins/LadspaEffect/LadspaMatrixControlDialog.cpp +++ b/plugins/LadspaEffect/LadspaMatrixControlDialog.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "LadspaBase.h" @@ -40,6 +41,8 @@ #include "LadspaControlView.h" #include "LedCheckBox.h" +#include "GuiApplication.h" +#include "MainWindow.h" namespace lmms::gui @@ -198,6 +201,20 @@ void LadspaMatrixControlDialog::updateEffectView(LadspaControls * ladspaControls // From: https://forum.qt.io/topic/13374/solved-qscrollarea-vertical-scroll-only/4 m_scrollArea->setMinimumWidth(matrixWidget->minimumSizeHint().width() + m_scrollArea->verticalScrollBar()->width()); + + // Make sure that the widget is shown without a scrollbar whenever possible + // If the widget fits on the workspace we use the height of the widget as the minimum size of the scroll area. + // This will ensure that the scrollbar is not shown initially (and never will be). + // If the widget is larger than the workspace then we want it to mostly cover the workspace. + // + // This is somewhat ugly but I have no idea how to control the initial size of the scroll area otherwise + auto const workspaceSize = getGUI()->mainWindow()->workspace()->viewport()->size(); + // Make sure that we always account a minumum height for the workspace, i.e. that we never compute + // something close to 0 if the LMMS window is very small + int workspaceHeight = qMax(200, static_cast(workspaceSize.height() * 0.9)); + int minOfWidgetAndWorkspace = qMin(matrixWidget->minimumSizeHint().height(), workspaceHeight); + m_scrollArea->setMinimumHeight(minOfWidgetAndWorkspace); + if (getChannelCount() > 1 && m_stereoLink != nullptr) { m_stereoLink->setModel(&ladspaControls->m_stereoLinkModel);