Path QML Type
Import Statement: | import QtQuick |
Inherited By: |
属性
- asynchronous : bool
(since 6.9)
- closed : bool
- pathElements : list<PathElement>
- scale : size
(since QtQuick 2.14)
- simplify : bool
(since 6.6)
- startX : real
- startY : real
方法
- point pointAtPercent(real t)
(since QtQuick 2.14)
详细描述
路径由一个或多个路径段组成 -PathLine,PathPolyline,PathQuad,PathCubic,PathArc,PathAngleArc,PathCurve,PathSvg 。
可以通过PathPercent 对象调整路径上项目的间距。
PathAttribute 路径允许沿路径定义带值的命名属性。
PathView 和Shape 共享 Path 和其他用于指定路径元素的类型。下表概述了各种路径元素的适用性:
元素 | PathView | 形状 | 形状,软件 |
---|---|---|---|
PathMove | 不适用 | 不适用 | 不适用 |
PathLine | 是 | 是 | 是 |
PathPolyline | 是 | 是 | 是 |
PathMultiline | 是 | 是 | 是 |
PathQuad | 是 | 是 | 是 |
PathCubic | 是 | 是 | 是 |
PathArc | 是 | 是 | 是 |
PathAngleArc | 是 | 是 | 是 |
PathSvg | 是 | 是 | 是 |
PathRectangle | 是 | 是 | 是 |
PathAttribute | 是 | 不适用 | 不适用 |
PathPercent | 是 | 不适用 | 不适用 |
PathCurve | 不适用 | 不适用 | 无 |
注: 路径是一种非可视类型;它本身不显示任何内容。要绘制路径,请使用Shape 。
另请参阅 PathView,Shape,PathAttribute,PathPercent,PathLine,PathPolyline,PathMove,PathQuad,PathCubic,PathArc,PathAngleArc,PathCurve,PathSvg, 和PathRectangle 。
属性文档
asynchronous : bool |
closed : bool |
该属性显示路径的起点和终点是否相同。
pathElements : list<PathElement> |
该属性显示组成路径的对象。
路径可包含以下路径对象:
- PathLine - 到达给定位置的直线。
- PathPolyline - 以坐标列表形式指定的折线。
- PathMultiline - 指定为坐标列表的多段线列表。
- PathQuad - 到指定位置的带控制点的二次贝塞尔曲线
- PathCubic - 用两个控制点在指定位置绘制的三次贝塞尔曲线
- PathArc - 半径为指定位置的弧线
- PathAngleArc - 由中心点、半径和角度指定的圆弧
- PathSvg - 以 SVG 路径数据字符串指定的路径。
- PathRectangle - 指定位置和大小的矩形
- PathCurve - Catmull-Rom 曲线上的点。
- PathAttribute - 路径中给定位置的属性。
- PathPercent - 沿路径各段分散项目的方法。
PathView { anchors.fill: parent model: ContactModel {} delegate: delegate path: Path { startX: 120; startY: 100 PathAttribute { name: "iconScale"; value: 1.0 } PathAttribute { name: "iconOpacity"; value: 1.0 } PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 } PathAttribute { name: "iconScale"; value: 0.3 } PathAttribute { name: "iconOpacity"; value: 0.5 } PathQuad { x: 120; y: 100; controlX: -20; controlY: 75 } } }
scale : size |
该属性包含路径的缩放因子。scale 的宽度和高度可以不同,以实现各向异性缩放。
注意: 设置此属性不会影响边框宽度。
该属性在 QtQuick 2.14 中引入。
simplify : bool |
设置为 true 时,路径将被简化。这意味着合并所有相交的子路径,创建一个没有自交的路径。连续的平行线也会被合并。简化后的路径将与ShapePath.OddEvenFill 一起使用。由于贝塞尔曲线相交的数值不稳定,贝塞尔曲线可能会被扁平化为线段。
此属性在 Qt 6.6 中引入。
方法文档
返回当前路径t 百分比处的点。参数t 必须介于 0 和 1 之间。
注: 与QPainterPath 中的其他百分比方法类似,如果路径中存在曲线,百分比测量与长度的关系不是线性的。如果存在曲线,百分比参数将映射到贝塞尔方程的t
参数。
此方法在 QtQuick 2.14 中引入。
另请参阅 QPainterPath::pointAtPercent().
© 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.