From ba6a86d331ec2707a8dc6e244641bcdffb385ffe Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Mon, 22 Jul 2019 01:11:30 +0200 Subject: [PATCH 1/2] TabWidget: Improve size hints --- src/gui/widgets/TabWidget.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 125bbbd74..22d322612 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -319,8 +319,8 @@ QSize TabWidget::minimumSizeHint() const for ( widgetStack::const_iterator it = m_widgets.begin(); it != m_widgets.end(); ++it ) { - maxWidth = std::max(maxWidth, it->w->width()); - maxHeight = std::max(maxHeight, it->w->height()); + maxWidth = std::max(maxWidth, it->w->minimumSizeHint().width()); + maxHeight = std::max(maxHeight, it->w->minimumSizeHint().height()); } // "-1" : // in "addTab", under "Position tab's window", the widget is @@ -335,7 +335,21 @@ QSize TabWidget::minimumSizeHint() const QSize TabWidget::sizeHint() const { - return minimumSizeHint(); + if (m_resizable) + { + int maxWidth = 0, maxHeight = 0; + for ( widgetStack::const_iterator it = m_widgets.begin(); + it != m_widgets.end(); ++it ) + { + maxWidth = std::max(maxWidth, it->w->sizeHint().width()); + maxHeight = std::max(maxHeight, it->w->sizeHint().height()); + } + // "-1" : + // in "addTab", under "Position tab's window", the widget is + // moved up by 1 pixel + return QSize(maxWidth + 4, maxHeight + m_tabbarHeight - 1); + } + else { return QWidget::sizeHint(); } } From 6e7c4a47c2478804f2b07d0bc50caaddf1049d5f Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Mon, 22 Jul 2019 01:14:02 +0200 Subject: [PATCH 2/2] Fixes #5061: Fix Effect Rack View in Instrument The EffectRackView in an InstrumentTrackWindow had some parts hidden when loading files with >= 4 effects. This was now fixed by force-resizing the EffectRackView to its desired size. It's a dirty fix, but good enough, plus many Instrument UIs might get rewritten to be resizable in the future. --- src/tracks/InstrumentTrack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 5466dd806..4c71eeef6 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1477,6 +1477,8 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : adjustTabSize(m_ssView); adjustTabSize(instrumentFunctions); adjustTabSize(m_effectView); + // stupid bugfix, no one knows why + m_effectView->resize(INSTRUMENT_WIDTH - 4, INSTRUMENT_HEIGHT - 4 - 1); adjustTabSize(m_midiView); adjustTabSize(m_miscView);