PathCurve QML Type

定义 Catmull-Rom 曲线上的一个点。更多

Import Statement: import QtQuick

属性

详细说明

PathCurve 提供了一种简单的方法来指定一条直接通过一组点的曲线。通常情况下,多条 PathCurve 曲线会串联使用,下面的示例就是证明:

import QtQuick

Canvas {
    width: 400; height: 200
    contextType: "2d"

    Path {
        id: myPath
        startX: 0; startY: 100

        PathCurve { x: 75; y: 75 }
        PathCurve { x: 200; y: 150 }
        PathCurve { x: 325; y: 25 }
        PathCurve { x: 400; y: 100 }
    }

    onPaint: {
        context.strokeStyle = Qt.rgba(.4,.6,.8);
        context.path = myPath;
        context.stroke();
    }
}

该示例产生的路径如下(起点和 PathCurve 点用红色标出):

另请参见 Path,PathLine,PathQuad,PathCubic,PathArcPathSvg

属性文档

x : real

y : real

定义曲线的终点。

另请参阅 relativeXrelativeY


relativeX : real

relativeY : real

定义曲线相对于起点的终点。

如果同时为一个轴指定了相对和绝对的终点位置,则将使用相对位置。

相对位置和绝对位置可以混合使用,例如可以设置相对的 x 和绝对的 y。

另请参阅 xy


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.