mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add time step slider to 3d views (#9695)
Add new toolbar with slider that controls visible timestep in the view
This commit is contained in:
committed by
Magne Sjaastad
parent
dc5d53ad20
commit
fd5d6691c7
@@ -728,6 +728,19 @@ void RiuMainWindow::createToolBars()
|
||||
m_animationToolBar = new caf::AnimationToolBar( "Animation", this );
|
||||
addToolBar( m_animationToolBar );
|
||||
|
||||
{
|
||||
QToolBar* toolbar = addToolBar( tr( "Timestep Slider" ) );
|
||||
toolbar->setObjectName( toolbar->windowTitle() );
|
||||
|
||||
m_animationSlider = new QSlider( Qt::Horizontal, toolbar );
|
||||
m_animationSliderAction = toolbar->addWidget( m_animationSlider );
|
||||
|
||||
connect( m_animationSlider, SIGNAL( valueChanged( int ) ), SLOT( slotAnimationSliderMoved( int ) ) );
|
||||
}
|
||||
|
||||
// make sure slider updates if user uses animation toolbar
|
||||
connect( m_animationToolBar, SIGNAL( frameChanged( int ) ), SLOT( slotAnimationControlFrameChanged( int ) ) );
|
||||
|
||||
refreshAnimationActions();
|
||||
refreshDrawStyleActions();
|
||||
}
|
||||
@@ -1032,6 +1045,28 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
m_animationToolBar->setCurrentTimeStepIndex( currentTimeStepIndex );
|
||||
|
||||
m_animationToolBar->setEnabled( enableAnimControls );
|
||||
|
||||
m_animationSliderAction->setEnabled( enableAnimControls );
|
||||
m_animationSlider->blockSignals( true );
|
||||
m_animationSlider->setMaximum( timeStepStrings.size() - 1 );
|
||||
m_animationSlider->setMinimum( 0 );
|
||||
m_animationSlider->setSingleStep( 1 );
|
||||
m_animationSlider->setPageStep( 1 );
|
||||
m_animationSlider->setValue( currentTimeStepIndex );
|
||||
m_animationSlider->blockSignals( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAnimationControlFrameChanged( int frameIndex )
|
||||
{
|
||||
if ( m_animationSlider )
|
||||
{
|
||||
m_animationSlider->blockSignals( true );
|
||||
m_animationSlider->setValue( frameIndex );
|
||||
m_animationSlider->blockSignals( false );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1862,6 +1897,18 @@ void RiuMainWindow::updateScaleValue()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAnimationSliderMoved( int newValue )
|
||||
{
|
||||
if ( RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer() )
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->viewer()->setCurrentFrame( newValue );
|
||||
}
|
||||
m_animationToolBar->setCurrentTimeStepIndex( newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: This function will be moved to a class responsible for handling the application selection concept
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user