Fix minimum size of LADSPA dialogs (#6982) (#7019)

Remove the code which computes a minimum height for the LADSPA dialogs. It was intended to make sure that no scrollbar is shown in most cases. However, doing so came at the cost that the computed height was the minimum height as well. Therefore the dialogs took a lot of space on low-res displays and could not be made smaller.

After the removal the behavior is still sane. Small dialogs are shown in full and dialogs which are larger, e.g. "Calf Equalizer 12 Band LADSPA", seem to be sized around half the height of the workspace and show scrollbars.
This commit is contained in:
Michael Gregorius
2023-12-31 11:49:15 +01:00
committed by GitHub
parent 6b21dc7896
commit bf4e57da19

View File

@@ -41,9 +41,6 @@
#include "LadspaControlView.h"
#include "LedCheckBox.h"
#include "GuiApplication.h"
#include "MainWindow.h"
namespace lmms::gui
{
@@ -206,20 +203,6 @@ 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<int>(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);