1

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. See attached picenter image description here

(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.

go4sri
  • 1,490
  • 2
  • 15
  • 29

1 Answers1

0

From looking at the Qt documentation there is a way to calculate the pixel position from the current silder value with: QStyle::sliderPositionFromValue Qt documentation

codencandy
  • 1,701
  • 1
  • 10
  • 20