From 91099e28d56bdb0ddf4c37da6a23582f92b52db1 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Sat, 20 Apr 2019 13:23:42 +0200 Subject: [PATCH] Fix -1 offset in plugin tab In the instrument plugin tab, there was an orange stripe for TripleOscillator. This was because internally, TabWidget moves up the widget by 1 (TabWidget.cpp, line 89). The size of the whole window is: ``` widget->height() + m_tabbarHeight - 1 ``` So this code adds an offset of "-1" to the necessary computations. --- src/gui/widgets/TabWidget.cpp | 5 ++++- src/tracks/InstrumentTrack.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 49898a3c7..6049ce6cb 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -321,7 +321,10 @@ QSize TabWidget::minimumSizeHint() const maxWidth = std::max(maxWidth, it->w->width()); maxHeight = std::max(maxHeight, it->w->height()); } - return QSize(maxWidth + 4, maxHeight + m_tabbarHeight); + // "-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::minimumSizeHint(); diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 69924c8be..5466dd806 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1439,7 +1439,10 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : m_tabWidget = new TabWidget( "", this, true, true ); - m_tabWidget->setMinimumHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 4 ); + // "-1" : + // in "TabWidget::addTab", under "Position tab's window", the widget is + // moved up by 1 pixel + m_tabWidget->setMinimumHeight( INSTRUMENT_HEIGHT + GRAPHIC_TAB_HEIGHT - 4 - 1 ); // create tab-widgets @@ -1857,7 +1860,10 @@ void InstrumentTrackWindow::viewPrevInstrument() void InstrumentTrackWindow::adjustTabSize(QWidget *w) { - w->setMinimumSize(INSTRUMENT_WIDTH - 4, INSTRUMENT_HEIGHT - 4); + // "-1" : + // in "TabWidget::addTab", under "Position tab's window", the widget is + // moved up by 1 pixel + w->setMinimumSize(INSTRUMENT_WIDTH - 4, INSTRUMENT_HEIGHT - 4 - 1); } #include "InstrumentTrack.moc"