Important: Please read the Qt Code of Conduct -

Position of QSlider in a widget

  • I am trying to draw a line between two sliders in Qt. When I move either of the sliders, I want the line to move such that it always joins the two sliders.
    ! image)!
    (I have drawn the line for illustration - not programatically)
    How do I do that? The problem is with identifying the position of the sliders. How do I get their locations? either within the widget or within the screen? Once I get their positions, I will be able to draw the line.

    Any ideas? Let me know if you want me to post the code, but basically, all I have is two QSliders - one on top and one at the bottom.

  • [[doc:QStyle]] allows you to query the position of sub-controls. Perhaps it will allow you to query the rect for the handle of a slider.

Log in to reply