+ class TDoubleSliderWith2Lables: public QHBox
+ {
+ public:
+ TDoubleSliderWith2Lables( const QString& leftLabel, const QString& rightLabel,
+ const double initValue, const double bottom,
+ const double top , const double precision,
+ QWidget * parent=0 , const char * name=0 )
+ :QHBox(parent,name), _bottom(bottom), _precision(precision)
+ {
+ if ( !leftLabel.isEmpty() ) (new QLabel( this ))->setText( leftLabel );
+ _slider = new QSlider( Horizontal, this );
+ _slider->setRange( 0, toInt( top ));
+ _slider->setValue( toInt( initValue ));
+ if ( !rightLabel.isEmpty() ) (new QLabel( this ))->setText( rightLabel );
+ }
+ double value() const { return _bottom + _slider->value() * _precision; }
+ QSlider * getSlider() const { return _slider; }
+ int toInt( double val ) const { return (int) ceil(( val - _bottom ) / _precision ); }
+ private:
+ double _bottom, _precision;
+ QSlider * _slider;
+ };