Results 1 to 2 of 2

Thread: QSlider problem

  1. #1
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QSlider problem

    I am trying to get float values from a QSlider, but the problem is the QSlider only supports integers... and each slide can only support integer values too. I need float/double values. Is there an alternative for this?

    Here's a simple solution but does not work too. I tried setting my QSlider's minimum and maximum values to -1000 and 1000 so that I can just divide the integer values by 1000 again to get float values in the end. But all I get are zero values. What's wrong ?

    Qt Code:
    1. qDebug("Slider val: %.30lf", (float) (value / 1000));
    To copy to clipboard, switch view to plain text mode 
    Dragging the slider to the minimum I get
    Slider val: -1.000000000000000000000000000000

    Dragging the slider to the maximum I get
    Slider val: 1.000000000000000000000000000000

    but all values in the middle of maximum and minimum I get
    Slider val: 0.000000000000000000000000000000
    Image Analysis Development Framework Using Qt (IADFUQ)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSlider problem

    5 / 2 = 2
    5.0 / 2.0 = 2.5

  3. The following user says thank you to jacek for this useful post:

    sincnarf (10th October 2007)

Similar Threads

  1. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  2. QSlider Update Problem
    By December in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2006, 04:02
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.