Unsolved Qslider:setting float value
-
Hi
I wants to use a fm slider in my project .For that I am using QSlider.But upon moving the handle of the slider,am only getting int value.If am moving the slider to 91.9,valueChanged function vl give 91 and If I move to 91 it vl show 91 only.
Here is my codem_fmSlider = new QSlider(this); m_fmSlider->setOrientation(Qt::Horizontal); m_fmSlider->setGeometry(200,25,734,130); m_fmSlider->setMaximum(107); m_fmSlider->setMinimum(87); m_fmSlider->setTickPosition(QSlider::TicksBothSides); m_fmSlider->setTickInterval(10); m_fmSlider->setSingleStep(1); m_fmSlider->setStyleSheet( "QSlider::groove:horizontal {image: url(:/images/fm_scale.png);}" "QSlider::handle {image: url(:/images/radio_station_thumb.png);}"
);
connect(m_fmSlider, SIGNAL (sliderMoved(int )), this, SLOT (slot_onSliderMoved(int )));Regards
Divya -
@drd1988on That's because slider works with integer values.
Take a look at this: https://stackoverflow.com/questions/19003369/how-to-make-a-qslider-change-with-double-values -
Set the minimum to 870 and maximum to 1070. Divide the value by 10 in slot.