Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully hide song editor scrollbar when not needed #5101

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/gui/TrackContainerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,19 @@ void TrackContainerView::scrollToTrackView( TrackView * _tv )
void TrackContainerView::realignTracks()
{
QWidget * content = m_scrollArea->widget();
content->setFixedWidth( width()
- m_scrollArea->verticalScrollBar()->width() );

//Hide the vertical scrollbar *and* its scrollbar area when not needed
auto verticalScrollBar = m_scrollArea->verticalScrollBar();
if (verticalScrollBar->maximum() == verticalScrollBar->minimum())
{ //min == max implies the whole editor is visible without scrolling
verticalScrollBar->setStyleSheet("QScrollBar {width:0px;}");
content->setFixedWidth( width() );
}
else
{ //Otherwise we need a scrollbar, so restore it's width
verticalScrollBar->setStyleSheet("QScrollBar {}");
content->setFixedWidth( width() - verticalScrollBar->width() );
}
content->setFixedHeight( content->minimumSizeHint().height() );

for( trackViewList::iterator it = m_trackViews.begin();
Expand Down