From: apo Date: Thu, 15 May 2008 14:44:13 +0000 (+0000) Subject: Implementation of the sweep functionality X-Git-Tag: TG_VISU_2008_2008-06-26~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c1b22ac62a472248c4245cceccfdf1852d80fc5;p=modules%2Fvisu.git Implementation of the sweep functionality (make more compact layouting) --- diff --git a/src/VISUGUI/VisuGUI_Sweep.cxx b/src/VISUGUI/VisuGUI_Sweep.cxx index 54b8d2e8..7ae0ff2c 100644 --- a/src/VISUGUI/VisuGUI_Sweep.cxx +++ b/src/VISUGUI/VisuGUI_Sweep.cxx @@ -165,55 +165,56 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule, { QWidget* aPropertiesTab = new QWidget(); - QVBoxLayout* aVBoxLayout = new QVBoxLayout( aPropertiesTab ); + QGridLayout* aGridLayout = new QGridLayout( aPropertiesTab ); + { - QGridLayout* aGridLayout = new QGridLayout( aPropertiesTab ); - + QHBoxLayout* aHBoxLayout = new QHBoxLayout(); + QLabel* aModeAnnotation = new QLabel( aPropertiesTab ); aModeAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); aModeAnnotation->setText( tr( "MODE" ) ); - aGridLayout->addWidget( aModeAnnotation, 0, 0 ); - + aHBoxLayout->addWidget( aModeAnnotation ); + mySweepMode = new QComboBox( aPropertiesTab ); mySweepMode->insertItems( 0, QStringList() << tr( "LINEAR" ) << tr( "COSINUSOIDAL" ) << tr( "SINUSOIDAL" ) ); mySweepMode->setCurrentIndex( aResourceMgr->integerValue( "VISU", "sweeping_modes", 0 ) ); - aGridLayout->addWidget( mySweepMode, 0, 1 ); - + aHBoxLayout->addWidget( mySweepMode ); + myIntervals = new QComboBox( aPropertiesTab ); myIntervals->insertItems( 0, QStringList() << tr( "[ 0, +PI ]" ) << tr( "[ -PI, +PI ]" ) ); myIntervals->setCurrentIndex( aResourceMgr->integerValue( "VISU", "sweeping_is2PI", 0 ) ); - aGridLayout->addWidget( myIntervals, 0, 2 ); - - QLabel* aNumberOfStepsAnnotation = new QLabel( aPropertiesTab ); - aNumberOfStepsAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); - aNumberOfStepsAnnotation->setText( tr( "NUMBER_OF_STEPS" ) ); - aGridLayout->addWidget( aNumberOfStepsAnnotation, 1, 0 ); - - myNumberOfSteps = new QtxIntSpinBox( aPropertiesTab ); - connect( myNumberOfSteps, SIGNAL( valueChanged( int ) ), SLOT( onNumberOfStepsChanged( int ) ) ); - myNumberOfSteps->setValue( aResourceMgr->integerValue( "VISU", "sweeping_number_steps", 40 ) ); - aGridLayout->addWidget( myNumberOfSteps, 1, 1, 1, 2 ); - - QLabel* aStepDelayAnnotation = new QLabel( aPropertiesTab ); - aStepDelayAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); - aStepDelayAnnotation->setText( tr( "DELAY_BETWEEN_STEPS" ) ); - aGridLayout->addWidget( aStepDelayAnnotation, 2, 0 ); - - myStepDelay = new QtxDoubleSpinBox( aPropertiesTab ); - myStepDelay->setValue( aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1) ); - aGridLayout->addWidget( myStepDelay, 2, 1, 1, 2 ); - - QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - aGridLayout->addItem( aSpacerItem, 3, 0 ); - - aVBoxLayout->addLayout( aGridLayout ); + aHBoxLayout->addWidget( myIntervals ); + + aGridLayout->addLayout( aHBoxLayout, 0, 0, 1, 2 ); } + QLabel* aNumberOfStepsAnnotation = new QLabel( aPropertiesTab ); + aNumberOfStepsAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); + aNumberOfStepsAnnotation->setText( tr( "NUMBER_OF_STEPS" ) ); + aGridLayout->addWidget( aNumberOfStepsAnnotation, 1, 0, 1, 1 ); + + myNumberOfSteps = new QtxIntSpinBox( aPropertiesTab ); + connect( myNumberOfSteps, SIGNAL( valueChanged( int ) ), SLOT( onNumberOfStepsChanged( int ) ) ); + myNumberOfSteps->setValue( aResourceMgr->integerValue( "VISU", "sweeping_number_steps", 40 ) ); + aGridLayout->addWidget( myNumberOfSteps, 1, 1, 1, 1 ); + + QLabel* aStepDelayAnnotation = new QLabel( aPropertiesTab ); + aStepDelayAnnotation->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); + aStepDelayAnnotation->setText( tr( "DELAY_BETWEEN_STEPS" ) ); + aGridLayout->addWidget( aStepDelayAnnotation, 2, 0, 1, 1 ); + + myStepDelay = new QtxDoubleSpinBox( aPropertiesTab ); + myStepDelay->setValue( aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1) ); + aGridLayout->addWidget( myStepDelay, 2, 1, 1, 1 ); + + QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + aGridLayout->addItem( aSpacerItem, 3, 0 ); + aTabWidget->addTab( aPropertiesTab, tr( "PROPERTIES_TAB" ) ); } @@ -407,11 +408,13 @@ void VisuGUI_Sweep::onNumberOfStepsChanged( int value ) int anOldNumberOfSteps = mySweepSlider->maximum(); mySweepSlider->setMaximum( value ); - double aNewSweepValue = value / anOldNumberOfSteps * mySweepSlider->value(); - mySweepSlider->setValue( int( aNewSweepValue ) ); + double aValue = double( value ); + + double aNewSweepValue = aValue / anOldNumberOfSteps * mySweepSlider->value(); + mySweepSlider->setValue( int( aNewSweepValue + 1 ) ); - double aNewPageStep = value / anOldNumberOfSteps * mySweepSlider->pageStep(); - mySweepSlider->setPageStep( int( aNewPageStep ) ); + double aNewPageStep = aValue / 10; + mySweepSlider->setPageStep( int( aNewPageStep + 1 ) ); }