Merge pull request #8654 from OPM/filter_wheelevents

Summary Multiplot: page scroll and zoom fixes
This commit is contained in:
jonjenssen
2022-03-10 13:13:44 +01:00
committed by GitHub
parent 0d45b88d09
commit c9b762fb16
13 changed files with 244 additions and 11 deletions

View File

@@ -99,6 +99,7 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren
, m_titleVisible( true )
, m_subTitlesVisible( true )
, m_previewMode( true )
, m_currentPageIndex( 0 )
{
const int spacing = 8;
@@ -585,3 +586,30 @@ void RiuMultiPlotBook::applyLook()
m_book->setPalette( newPalette );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::changeCurrentPage( int pageDiff )
{
m_currentPageIndex += pageDiff;
if ( m_currentPageIndex >= (int)m_pages.size() ) m_currentPageIndex = (int)m_pages.size() - 1;
if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0;
if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::goToNextPage()
{
changeCurrentPage( 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::goToPrevPage()
{
changeCurrentPage( -1 );
}