From 64f80fa783dabc15cbea7e3c249eec89f1e71d29 Mon Sep 17 00:00:00 2001 From: saker Date: Thu, 26 Sep 2024 08:56:34 -0400 Subject: [PATCH] Partially revert #7453 (#7519) --- src/gui/EffectRackView.cpp | 4 +--- src/gui/EffectView.cpp | 3 ++- src/gui/instrument/EnvelopeAndLfoView.cpp | 2 -- src/gui/instrument/EnvelopeGraph.cpp | 4 ++-- src/gui/instrument/InstrumentView.cpp | 1 - 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/EffectRackView.cpp b/src/gui/EffectRackView.cpp index d815ea31107..b43ec7648b0 100644 --- a/src/gui/EffectRackView.cpp +++ b/src/gui/EffectRackView.cpp @@ -216,16 +216,14 @@ void EffectRackView::update() } else { - (*it)->resize(width() - 35, EffectView::DEFAULT_HEIGHT); ( *it )->move( EffectViewMargin, m_lastY ); - (*it)->update(); m_lastY += ( *it )->height(); ++nView; ++it; } } - w->resize(width() - 35 + 2 * EffectViewMargin, m_lastY); + w->setFixedSize(EffectView::DEFAULT_WIDTH + 2 * EffectViewMargin, m_lastY); QWidget::update(); } diff --git a/src/gui/EffectView.cpp b/src/gui/EffectView.cpp index 32472afc6a7..6f2b984c32a 100644 --- a/src/gui/EffectView.cpp +++ b/src/gui/EffectView.cpp @@ -52,7 +52,8 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : m_controlView(nullptr), m_dragging(false) { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // TODO: Actual effect resizing + setFixedSize(EffectView::DEFAULT_WIDTH, EffectView::DEFAULT_HEIGHT); + setFocusPolicy(Qt::StrongFocus); // Disable effects that are of type "DummyEffect" bool isEnabled = !dynamic_cast( effect() ); diff --git a/src/gui/instrument/EnvelopeAndLfoView.cpp b/src/gui/instrument/EnvelopeAndLfoView.cpp index 0f1f47e638f..1b639e6c326 100644 --- a/src/gui/instrument/EnvelopeAndLfoView.cpp +++ b/src/gui/instrument/EnvelopeAndLfoView.cpp @@ -85,11 +85,9 @@ EnvelopeAndLfoView::EnvelopeAndLfoView(QWidget * parent) : envelopeLayout->addLayout(graphAndAmountLayout); m_envelopeGraph = new EnvelopeGraph(this); - m_envelopeGraph->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); graphAndAmountLayout->addWidget(m_envelopeGraph); m_amountKnob = buildKnob(tr("AMT"), tr("Modulation amount:")); - m_amountKnob->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); graphAndAmountLayout->addWidget(m_amountKnob, 0, Qt::AlignCenter); QHBoxLayout* envKnobsLayout = new QHBoxLayout(); diff --git a/src/gui/instrument/EnvelopeGraph.cpp b/src/gui/instrument/EnvelopeGraph.cpp index 3102c02a93e..4cf5da74bfa 100644 --- a/src/gui/instrument/EnvelopeGraph.cpp +++ b/src/gui/instrument/EnvelopeGraph.cpp @@ -211,8 +211,8 @@ void EnvelopeGraph::paintEvent(QPaintEvent*) const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)}; // Determine the line width so that it scales with the widget - // Use the diagonal of the box to compute it - const qreal lineWidth = sqrt(width()*width() + height()*height()) / 80.; + // Use the minimum value of the current width and height to compute it. + const qreal lineWidth = std::min(width(), height()) / 20.; const QPen linePen{lineColor, lineWidth}; p.setPen(linePen); diff --git a/src/gui/instrument/InstrumentView.cpp b/src/gui/instrument/InstrumentView.cpp index 9b681b7964e..f7912444d96 100644 --- a/src/gui/instrument/InstrumentView.cpp +++ b/src/gui/instrument/InstrumentView.cpp @@ -45,7 +45,6 @@ InstrumentView::InstrumentView( Instrument * _Instrument, QWidget * _parent ) : InstrumentView::~InstrumentView() { - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); if( instrumentTrackWindow() ) { instrumentTrackWindow()->m_instrumentView = nullptr;