Results 1 to 6 of 6

Thread: Help Qslider

  1. #1
    Join Date
    Apr 2009
    Posts
    10
    Thanks
    5

    Default Help Qslider

    Hi guys!!!
    i have a problem using qslider. I wanna know if there is any way to know the exact value when i click anywhere in the qslider. That is, i click inside the qslider and i want to know wich is the value that i have clicked (inside the range of qslider).

    is there any signal or similar to catch it??

    Thanks a lot and sorry if the question is not clear at all, but i dont know how i can explain.

  2. #2
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help Qslider

    I might not understand what you mean, but the documentation should have the answer.

    Don't forget that QSlider inherits QAbstractSlider! QAbstractSlider::valueChanged() may be what you're looking for.

    And QAbstractSlider::sliderPosition() is the int value.
    Last edited by codeslicer; 7th July 2009 at 16:02. Reason: edited url

  3. #3
    Join Date
    Apr 2009
    Posts
    10
    Thanks
    5

    Default Re: Help Qslider

    I have read the doc and i dont find any answer to my problem. i want to click inside the qslider and get the position of the slider that i click. i dont want to know the slider position, i want to know the position i click inside the slider range.
    Sorry for the explanation.

  4. #4
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help Qslider

    But, when you click somewhere in the slider range, the slider value changes to the place you clicked. You can turn that feature on and off by changing the tracking() property (setTracking(bool)). So, tracking, on by default, changes the value every time the location of the slider is changed.

  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Help Qslider

    Quote Originally Posted by superteny View Post
    I have read the doc and i dont find any answer to my problem. i want to click inside the qslider and get the position of the slider that i click. i dont want to know the slider position, i want to know the position i click inside the slider range.
    Sorry for the explanation.
    if i understood correctly.. u need to reimplement

    Qt Code:
    1. void mousePressEvent(QMouseEvent *e)
    2. {
    3. QPoint position = e->pos();
    4.  
    5. QSlider::mousePressEvent(e);
    6. }
    To copy to clipboard, switch view to plain text mode 

    if you do not want to inherit qslider. then put a QObject::eventFilter() in the parent widget and catch the mouse press .

  6. The following user says thank you to nish for this useful post:

    superteny (9th July 2009)

  7. #6
    Join Date
    Apr 2009
    Posts
    10
    Thanks
    5

    Default Re: Help Qslider

    thanks for your help. i reimplement mousepressed and other mouse event and get the solution.

Similar Threads

  1. Problems customizing QSlider
    By Antrax in forum Qt Programming
    Replies: 13
    Last Post: 20th December 2011, 07:00
  2. Replies: 2
    Last Post: 6th July 2009, 12:53
  3. how to number the ticks of QSlider
    By babu198649 in forum Newbie
    Replies: 4
    Last Post: 11th June 2008, 13:46
  4. QSlider problem
    By sincnarf in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2007, 01:07
  5. Video and QSlider
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 1st May 2006, 19:37

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.