Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set value to QSlide

Set value to QSlide

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 600 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dohisev
    wrote on last edited by Dohisev
    #1

    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?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      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))

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved