Set value to QSlide



  • I'm using a library to play videos and the library gives me the length of the video as integer and the position as float, but the thing is, the length it gives is for example, a 1m video is 60000 in ms, but the current position is from 0.0 to 1, like:

    0.00333333
    0.00791667
    0.0125167
    0.0170833
    0.0216667
    0.02585
    0.0304333
    0.0350167
    0.0396
    0.0441667
    0.04835
    0.0529333
    0.0575167

    I set the range for the QSlider as the length of the video divided by 1000.0 that is 60 but now I don't know how to supply the value based on the float 0.1 to 1.

    What can I do?



  • just multiply the "float" by the maximum of the slider (assuming the slider has a minimum of 0)

    The general forumla is slider minimum + ( float* (slider maximum-slider minimum))


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.