Skip to content

Commit

Permalink
Fix -1 offset in plugin tab
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JohannesLorenz committed Apr 20, 2019
1 parent d52c220 commit 91099e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/gui/widgets/TabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 8 additions & 2 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

0 comments on commit 91099e2

Please sign in to comment.