Skip to content

Commit

Permalink
Hide scrollbar if the visible range covers the complete available range
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Feb 2, 2024
1 parent d51e571 commit 0fd2e5a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,32 @@ void RiuWellLogPlot::reinsertScrollbar()
int colCount = m_gridLayout->columnCount();
int rowCount = m_gridLayout->rowCount();

bool showScrollBar = !plotWidgets.empty();

if ( depthTrackPlot() )
{
double minVisible, maxVisible;
double minAvailable, maxAvailable;

depthTrackPlot()->visibleDepthRange( &minVisible, &maxVisible );
depthTrackPlot()->availableDepthRange( &minAvailable, &maxAvailable );

// Hide scrollbar if the visible range covers the complete available range
if ( minVisible <= minAvailable && maxVisible >= maxAvailable )
{
showScrollBar = false;
}
}

if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
{
m_gridLayout->addLayout( m_horizontalTrackScrollBarLayout, rowCount, 0, 1, colCount );
m_horizontalTrackScrollBar->setVisible( !plotWidgets.empty() );
m_horizontalTrackScrollBar->setVisible( showScrollBar );
}
else
{
m_gridLayout->addLayout( m_verticalTrackScrollBarLayout, 2, colCount, 1, 1 );
m_verticalTrackScrollBar->setVisible( !plotWidgets.empty() );
m_verticalTrackScrollBar->setVisible( showScrollBar );
m_gridLayout->setColumnStretch( colCount, 0 );
}
}
Expand Down

0 comments on commit 0fd2e5a

Please sign in to comment.