Results 1 to 9 of 9

Thread: How do I get the value from the slider's position?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do I get the value from the slider's position?

    JeremyK, for me this is some nonsense what You are doing - when new value of slider is 0 You are once more set it to 0. I suspect that the other methods are identical. What you really want to do?

  2. #2
    Join Date
    May 2013
    Location
    Amsterdam
    Posts
    4
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How do I get the value from the slider's position?

    Quote Originally Posted by Lesiok View Post
    JeremyK, for me this is some nonsense what You are doing - when new value of slider is 0 You are once more set it to 0. I suspect that the other methods are identical. What you really want to do?
    I just want the slider carry out the same function as each of the push buttons do. But instead of pressing each push button individually, I would rather that moving the slider would have the same effect.

    Cheers

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I get the value from the slider's position?

    For instance, if I move it to say 10, it works but then stays there regardless of moving the sllider. All of a sudden, it then jumps to 30 or 40. Any idea why?
    You have a slider with a range of zero to four, but are complaining about something with a value of 10, 30 or 40?

    The jerky behaviour is probably because whatever is executing in the slots associated with 1, 2, 3 etc. is taking some time to execute and blocking the UI while it does so. The slider emits a valueChanged() for every value you pass through, not just the value where you release the slider button.

    Ultimately though I have no idea what you are trying to achieve. The whole idea of using the position of a slider to execute discrete functions more logically assigned to buttons is truly odd. If you want all five actions to occur in sequence then just call the slot for each button in turn in response to pushing a "Do the lot" button.

  4. The following user says thank you to ChrisW67 for this useful post:

    JeremyK (19th May 2013)

  5. #4
    Join Date
    May 2013
    Location
    Amsterdam
    Posts
    4
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How do I get the value from the slider's position?

    Quote Originally Posted by ChrisW67 View Post
    You have a slider with a range of zero to four, but are complaining about something with a value of 10, 30 or 40?

    The jerky behaviour is probably because whatever is executing in the slots associated with 1, 2, 3 etc. is taking some time to execute and blocking the UI while it does so. The slider emits a valueChanged() for every value you pass through, not just the value where you release the slider button.

    Ultimately though I have no idea what you are trying to achieve. The whole idea of using the position of a slider to execute discrete functions more logically assigned to buttons is truly odd. If you want all five actions to occur in sequence then just call the slot for each button in turn in response to pushing a "Do the lot" button.
    It makes sense now. Got everything sorted.
    Thanks a lot for the help guys.

Similar Threads

  1. view position of mouse position in GraphicsScene
    By Raghaw in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2012, 04:46
  2. Replies: 4
    Last Post: 3rd August 2010, 12:30
  3. help on my slider
    By newb in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2010, 15:36
  4. Replies: 2
    Last Post: 21st March 2010, 09:01
  5. get slider value
    By eric in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2007, 19:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.