本页内容

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 点以红色突出显示):

一条Catmull-Rom曲线,经过五个用红色标出的点,形成波浪状图案

另请参阅 Path 、PathLine 、PathQuad 、PathCubic 、PathArc 以及PathSvg 。

属性文档

relativeX : real

relativeY : real

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

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

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

另请参阅 x 和y 。

x : real

y : real

定义曲线的端点。

另请参阅 relativeX 和relativeY 。

© 2026 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.