From e33d18cd262e41416e20f0f85d471078f3db3fd2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 2 Feb 2024 08:19:49 +0100 Subject: [PATCH] Hide scrollbar if the visible range covers the complete available range --- .../UserInterface/RiuWellLogPlot.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index 466fb8a6c2..dd6f3bff3b 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -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 ); } }