How would I implement the following curve editor in QT? (link inside)
-
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.
-
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?
-
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.
-
@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?
-
Hi @sol_aries
Just read about QMouseEvent