From b7ce235ebdba4ed7068e4fb1bc730b39ba675e83 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 3 Nov 2006 13:46:10 +0000 Subject: [PATCH] 1. To update geometry on selection update 2. To adjust layouting --- src/VISUGUI/VisuGUI_Slider.cxx | 42 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index f32198c8..d4b69b82 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -59,6 +59,7 @@ #include #include #include +#include /*! Constructor @@ -83,57 +84,60 @@ VisuGUI_Slider::VisuGUI_Slider( VVTK_ViewWindow* theViewWondow, aTopBox->setSpacing( 6 ); myFirstTimeStamp = new QLabel( aTopBox ); - myFirstTimeStamp->setMinimumWidth( 50 ); + myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myFirstTimeStamp->setText( "" ); mySlider = new QSlider( 0, 1, 1, 0, Qt::Horizontal, aTopBox ); //mySlider->setTickmarks( QSlider::Below ); + mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); mySlider->setTracking( false ); myLastTimeStamp = new QLabel( aTopBox ); - myLastTimeStamp->setMinimumWidth( 50 ); + myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myLastTimeStamp->setText( "" ); myTimeStampsNumber = new QLabel( aTopBox ); - myTimeStampsNumber->setMinimumWidth( 50 ); + myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myTimeStampsNumber->setText( "" ); myTimeStampStrings = new QComboBox( aTopBox ); - myTimeStampStrings->setFixedWidth( 120 ); + myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myTimeStampIndices = new QComboBox( aTopBox ); - myTimeStampIndices->setFixedWidth( 50 ); + myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); // Buttons QHBox* aBottomBox = new QHBox( aWidget ); aBottomBox->setSpacing( 6 ); myMoreButton = new QPushButton( tr( "MORE" ), aBottomBox ); - myMoreButton->setMaximumWidth( 100 ); + myMoreButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myMoreButton->setToggleButton( true ); myMoreButton->setEnabled( false ); myFirstButton = new QPushButton( tr( "|<<" ), aBottomBox ); - myFirstButton->setMaximumWidth( 100 ); + myFirstButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myPreviousButton = new QPushButton( tr( "<<" ), aBottomBox ); - myPreviousButton->setMaximumWidth( 100 ); + myPreviousButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myPlayButton = new QPushButton( tr( ">" ), aBottomBox ); - myPlayButton->setMaximumWidth( 100 ); + myPlayButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myPlayButton->setToggleButton( true ); myNextButton = new QPushButton( tr( ">>" ), aBottomBox ); - myNextButton->setMaximumWidth( 100 ); + myNextButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myLastButton = new QPushButton( tr( ">>|" ), aBottomBox ); - myLastButton->setMaximumWidth( 100 ); + myLastButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); new QLabel( tr( "SPEED" ), aBottomBox ); mySpeedBox = new QSpinBox( 1, 100, 1, aBottomBox ); + mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); mySpeedBox->setValue( 50 ); myAVIBox = new QCheckBox( tr( "AVI" ), aBottomBox ); + myAVIBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); myAVIBox->setEnabled( false ); myTimer = new QTimer( this ); @@ -217,6 +221,12 @@ void VisuGUI_Slider::enableControls( bool on ) myPlayButton->setOn( false ); } + myTimeStampStrings->setFont(myTimeStampStrings->font()); + myTimeStampStrings->updateGeometry(); + + myTimeStampIndices->setFont(myTimeStampStrings->font()); + myTimeStampIndices->updateGeometry(); + widget()->setEnabled( on ); } @@ -316,11 +326,12 @@ void VisuGUI_Slider::onValueChanged( int value ) if( myPrsList.size() == 0 ) return; - myTimeStampStrings->setCurrentItem( value ); - myTimeStampIndices->setCurrentItem( value ); - VISU::ColoredPrs3d_i* aPrs = myPrsList[0]; VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = aPrs->GetTimeStampsRange(); + CORBA::Long aLength = aTimeStampsRange->length(); + if(value < 0 || aLength <= value) + return; + CORBA::Long aNumber = aTimeStampsRange[ value ].myNumber; for( int i = 0, n = myPrsList.size(); i < n; i++ ) @@ -330,6 +341,9 @@ void VisuGUI_Slider::onValueChanged( int value ) aPrs->Apply(); } + myTimeStampStrings->setCurrentItem( value ); + myTimeStampIndices->setCurrentItem( value ); + myMainWindow->Repaint(); } -- 2.39.2