PDA

View Full Version : Fixed point while dragging curve



bchinfosieeuw
14th August 2016, 17:48
How to set a fixed point on one of the endpoints of a curve, that is fixed while dragging so the shape of the curve changes? (-item1.y is the y-coordinate of the Item-id; this is a fixed number with normal rectangles)



Path {
id: bendline
startX: -146; startY: -12
PathCurve { x: -138; y: -17 }
PathCurve { x: -132; y: -25 }
PathCurve { x: -130; y: -item1.y+365 }
property color mycolor: "black"
}

MouseArea {
anchors.fill: parent
onPositionChanged: {
if (mouse.buttons & Qt.LeftButton) {
bendline.x -= (x - mouse.x); bendline.y = -item1.y+365;
}
}

PathView {
id: bendView;
x: 10
y: 20
model: { item1.y >= 387 && item1.y < 459 ? 300 : 0 }
path: bendline
delegate: Rectangle {
id: dot;
width: 1; height: 1;
color: bendline.mycolor
}
}

bchinfosieeuw
15th August 2016, 09:02
SOLVED, by myself.

anda_skoa
15th August 2016, 18:36
Would be cool if you could post the solution, in case someone else encounters a similar problem and finds this thread :)

Cheers,
_