How would I implement the following curve editor in QT? (link inside)

  • CurveEdit

    Googling and looking through forums did not help. I'm not sure where to start with it.

    Link starts in an item list, then expands into a pop-up with a curve editor that the user can edit by dragging the curve around. The dragging the curve around in a graph is what I would like to know how to do. Thanks.

  • Lifetime Qt Champion


    Do you mean something like this ?

  • Thanks for the link. Seems like that particular implementation has external dependencies. It also works by moving control points around. In my example there are no control points. Left mouse dragging anywhere on the graph area will move the curve based on your x/y movements. Hmm, maybe the control point can be as big as the window and invisible?

  • Qt Champions 2017

    You'd still probably need some dependency. If you don't want the spline evaluation one, at least you'd need a matrix solver. The simplest to implement is actually to use a cubic (or log-square) polyharmonic spline.

  • @kshegunov How about the part in my link where you drag the curve around? The link provided by SGaist works by moving control points around. My link has no control points. Clicking and dragging anywhere in the pop up window will move the curve, and update the value in both the original box and the popup.

  • Qt Champions 2018

    The drag part is the easy part to implement. What we are suggesting is how to get the curve, i.e. given a number of the "attenuation" parameter, are you able to draw the corresponding curve?

  • @VRonin I appreciate pointing me at curve functions, I guess I didn't make clear that the dragging part is the part I can't figure out. Widgets are not normally 'live' like in the link example - clicking anywhere on the graph and dragging the mouse causes a change. Can I capture mouse deltas while in the widget?

  • Qt Champions 2018

    Hi @sol_aries

    Just read about QMouseEvent

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.