user198725878
user198725878

Reputation: 6386

slider is not moving

I am implementing slider in my app like below...

Slider = new QSlider(this);
Slider->setOrientation (  Qt::Horizontal );

when I run the app it shows the slider but i cant able to move the slider handle...

what I am doing wrong ...

Upvotes: 0

Views: 1424

Answers (2)

Kms254
Kms254

Reputation: 36

If you wanted to do it all in the constructor:

QSlider::QSlider( int minValue, int maxValue, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )

like this:

Slider= new QSlider( 0, 100, 1, 0, Qt::Horizontal, this);

Assuming you are using a percentage of 0<->100,

Upvotes: 0

Casey
Casey

Reputation: 6326

You need to set the minimum and maximum values with:

void    setMaximum ( int )
void    setMinimum ( int )

Optionally set the initial value with void setValue ( int )

Upvotes: 5

Related Questions