diff --git a/include/InstrumentView.h b/include/InstrumentView.h index 40014a11f32..885cb602a3a 100644 --- a/include/InstrumentView.h +++ b/include/InstrumentView.h @@ -42,6 +42,8 @@ class LMMS_EXPORT InstrumentView : public PluginView InstrumentView( Instrument * _instrument, QWidget * _parent ); ~InstrumentView() override; + virtual bool isResizable() const { return false; } + Instrument * model() { return( castModel() ); diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 1fb8596625e..42f0f3252e8 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -277,7 +277,9 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : vlayout->addWidget( generalSettingsWidget ); // Use QWidgetItem explicitly to make the size hint change on instrument changes // QLayout::addWidget() uses QWidgetItemV2 with size hint caching - vlayout->insertItem(1, new QWidgetItem(m_tabWidget)); + + vlayout->addWidget( m_tabWidget, 1 ); + m_tabWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); @@ -288,9 +290,19 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : if (!m_instrumentView->isResizable()) { flags |= Qt::MSWindowsFixedSizeDialogHint; // any better way than this? + subWin->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + if (subWin->layout()) + { + subWin->layout()->setSizeConstraint(QLayout::SetFixedSize); + } } else { subWin->setMaximumSize(m_instrumentView->maximumHeight() + 12, m_instrumentView->maximumWidth() + 208); subWin->setMinimumSize( m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208); + subWin->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + if (subWin->layout()) + { + subWin->layout()->setSizeConstraint(QLayout::SetNoConstraint); + } } flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); @@ -311,7 +323,7 @@ void InstrumentTrackWindow::resizeEvent(QResizeEvent * event) { adjustTabSize(m_instrumentView); adjustTabSize(m_instrumentFunctionsView); adjustTabSize(m_ssView); - adjustTabSize(m_effectView); + // EffectRackView has sizeHint to be QSize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1) adjustTabSize(m_midiView); adjustTabSize(m_tuningView); } @@ -482,6 +494,7 @@ void InstrumentTrackWindow::updateInstrumentView() m_track->dataChanged(); // Get the text on the trackButton to change adjustTabSize(m_instrumentView); + m_instrumentView->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); m_pianoView->setVisible(m_track->m_instrument->hasNoteInput()); // adjust window size layout()->invalidate(); diff --git a/src/gui/instrument/InstrumentTuningView.cpp b/src/gui/instrument/InstrumentTuningView.cpp index daa361aad6b..d495eb98ae9 100644 --- a/src/gui/instrument/InstrumentTuningView.cpp +++ b/src/gui/instrument/InstrumentTuningView.cpp @@ -64,7 +64,7 @@ InstrumentTuningView::InstrumentTuningView(InstrumentTrack *it, QWidget *parent) masterPitchLayout->addWidget(tlabel); // Microtuner settings - m_microtunerNotSupportedLabel = new QLabel(tr("Microtuner is not available for MIDI-based instruments.")); + m_microtunerNotSupportedLabel = new QLabel(tr("Microtuner is not available\nfor MIDI-based instruments.")); m_microtunerNotSupportedLabel->setWordWrap(true); m_microtunerNotSupportedLabel->hide(); layout->addWidget(m_microtunerNotSupportedLabel); diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index a370c1ea9fb..98210c0ed54 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -90,6 +90,12 @@ void TabWidget::addTab(QWidget* w, const QString& name, const char* pixmap, int { w->setFixedSize(width() - 4, height() - m_tabbarHeight); } + else + { + w->setSizePolicy(sizePolicy()); + } + if(w->minimumHeight() > minimumHeight() || w->minimumSizeHint().height() > minimumHeight()) { setMinimumHeight(w->minimumHeight()); } + if(w->minimumWidth() > minimumWidth() || w->minimumSizeHint().width() > minimumWidth()) { setMinimumWidth(w->minimumWidth()); } w->move(2, m_tabbarHeight - 1); w->hide(); @@ -197,9 +203,26 @@ void TabWidget::mousePressEvent(QMouseEvent* me) -void TabWidget::resizeEvent(QResizeEvent*) +void TabWidget::resizeEvent(QResizeEvent* ev) { - if (!m_resizable) + if (m_resizable) + { + for (const auto& widget : m_widgets) + { + if(widget.w->minimumSize().height() > ev->size().height() - 4 || + widget.w->minimumSize().width() > ev->size().width() - m_tabbarHeight) + { + ev->ignore(); + return; + } + } + for (const auto& widget : m_widgets) + { + widget.w->resize(width() - 4, height() - m_tabbarHeight); + } + QWidget::resizeEvent(ev); + } + else { for (const auto& widget : m_widgets) {