From 2a3df337a6564c5ad1ce7dec8431513cf1377614 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Thu, 30 May 2024 17:53:43 +0200 Subject: [PATCH 1/2] Make mixer channels resizable Make the mixer channels resizable within the mixer view. Remove the setting of the size policy from `MixerChannelView`. Add the `Fader` widget with a stretch factor so that it is resized within the layout of the mixer channel/strip. Remove the stretch that was added to the layout because the fader now stretches. In `MixerView` remove the top alignments when widgets are added to the layout so that they can resize. Set the channel layout to align to the left so that it behaves correctly when it is resized by the scroll area it is contained in. Make the widget resizable in the scroll area so that it always fills the space. Set the minimum height of the scroll area to the minimum size of the widget plus the scrollbar height so that the channel strips are never overlapped by the scrollbar. Set the size policy of the "new channel" button so that it grows vertically with the mixer view. Set a fixed size so that it is as wide as a mixer strip. --- src/gui/MixerChannelView.cpp | 5 +---- src/gui/MixerView.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 22251d55133..0afdb684e78 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -51,8 +51,6 @@ namespace lmms::gui m_mixerView(mixerView), m_channelIndex(channelIndex) { - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); - auto retainSizeWhenHidden = [](QWidget* widget) { auto sizePolicy = widget->sizePolicy(); @@ -133,10 +131,9 @@ namespace lmms::gui mainLayout->addWidget(m_sendKnob, 0, Qt::AlignHCenter); mainLayout->addWidget(m_sendArrow, 0, Qt::AlignHCenter); mainLayout->addWidget(m_channelNumberLcd, 0, Qt::AlignHCenter); - mainLayout->addStretch(); mainLayout->addWidget(m_renameLineEditView, 0, Qt::AlignHCenter); mainLayout->addLayout(soloMuteLayout, 0); - mainLayout->addWidget(m_fader, 0, Qt::AlignHCenter); + mainLayout->addWidget(m_fader, 1, Qt::AlignHCenter); connect(m_renameLineEdit, &QLineEdit::editingFinished, this, &MixerChannelView::renameFinished); } diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index e97b5414fd7..6fc67f14318 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -89,6 +89,7 @@ MixerView::MixerView(Mixer* mixer) : chLayout->setSizeConstraint(QLayout::SetMinimumSize); chLayout->setSpacing(0); chLayout->setContentsMargins(0, 0, 0, 0); + chLayout->setAlignment(Qt::AlignLeft); m_channelAreaWidget->setLayout(chLayout); // create rack layout before creating the first channel @@ -105,7 +106,7 @@ MixerView::MixerView(Mixer* mixer) : m_racksLayout->addWidget(m_mixerChannelViews[0]->m_effectRackView); - ml->addWidget(masterView, 0, Qt::AlignTop); + ml->addWidget(masterView, 0); auto mixerChannelSize = masterView->sizeHint(); @@ -137,18 +138,20 @@ MixerView::MixerView(Mixer* mixer) : channelArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); channelArea->setFrameStyle(QFrame::NoFrame); channelArea->setMinimumWidth(mixerChannelSize.width() * 6); + channelArea->setWidgetResizable(true); int const scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent); - channelArea->setFixedHeight(mixerChannelSize.height() + scrollBarExtent); + channelArea->setMinimumHeight(mixerChannelSize.height() + scrollBarExtent); - ml->addWidget(channelArea, 1, Qt::AlignTop); + ml->addWidget(channelArea, 1); // show the add new mixer channel button auto newChannelBtn = new QPushButton(embed::getIconPixmap("new_channel"), QString(), this); newChannelBtn->setObjectName("newChannelBtn"); - newChannelBtn->setFixedSize(mixerChannelSize); + newChannelBtn->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); + newChannelBtn->setFixedWidth(mixerChannelSize.width()); connect(newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel())); - ml->addWidget(newChannelBtn, 0, Qt::AlignTop); + ml->addWidget(newChannelBtn, 0); // add the stacked layout for the effect racks of mixer channels From 45de61c81e1015314e3b0afd7168f9fa6b60586c Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Thu, 30 May 2024 17:59:57 +0200 Subject: [PATCH 2/2] Enable maximization for mixer view Enable the maximize button for the mixer view now that it is fully resizable. --- src/gui/MixerView.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/MixerView.cpp b/src/gui/MixerView.cpp index 6fc67f14318..b9a698a96c6 100644 --- a/src/gui/MixerView.cpp +++ b/src/gui/MixerView.cpp @@ -168,9 +168,6 @@ MixerView::MixerView(Mixer* mixer) : // add ourself to workspace QMdiSubWindow* subWin = mainWindow->addWindowedWidget(this); - Qt::WindowFlags flags = subWin->windowFlags(); - flags &= ~Qt::WindowMaximizeButtonHint; - subWin->setWindowFlags(flags); layout()->setSizeConstraint(QLayout::SetMinimumSize); subWin->layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);