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
}
}
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
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks