From b8275e1002df8f6979d973497552ebe4d8643a62 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 3 Nov 2006 12:55:26 +0000 Subject: [PATCH] To update speed of "play" in run-time --- src/VISUGUI/VisuGUI_Slider.cxx | 10 ++++++++++ src/VISUGUI/VisuGUI_Slider.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index bf983a10..f32198c8 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -157,6 +157,8 @@ VisuGUI_Slider::VisuGUI_Slider( VVTK_ViewWindow* theViewWondow, connect( mySlider, SIGNAL( sliderMoved( int ) ), SLOT( onSliderMoved( int ) ) ); connect( mySlider, SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) ); + connect( mySpeedBox, SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) ); + connect( myTimer, SIGNAL( timeout() ), SLOT( onTimeout() ) ); enableControls( false ); @@ -331,6 +333,14 @@ void VisuGUI_Slider::onValueChanged( int value ) myMainWindow->Repaint(); } +void VisuGUI_Slider::onSpeedChanged( int value ) +{ + if(myPlayButton->isOn()){ + int delay = int(5000.0 / double(mySpeedBox->value())); + myTimer->start( delay ); + } +} + void VisuGUI_Slider::onTimeout() { int value = mySlider->value(); diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index 1a7e3a2c..d196ed69 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -81,6 +81,8 @@ public slots: virtual void onSliderMoved( int ); virtual void onValueChanged( int ); + virtual void onSpeedChanged( int ); + virtual void onTimeout(); private: -- 2.39.2