PathMultiline QML Type

通过坐标列表定义一组折线。更多

Import Statement: import QtQuick
Since: QtQuick 2.14

属性

详细说明

该元素允许同时定义一系列多段线。列表中的每条多段线前面都会有一个moveTo 命令,从而有效地使每条多段线成为一条独立的多段线。列表中的多段线应该互不相交。无论如何,当与ShapePath 一起使用时,包含ShapePathShapePath::fillRule 也适用。也就是说,在默认的OddEvenFill 和不相交的形状下,列表中最大的形状定义了要填充的区域;两个形状重叠的区域是孔;三个形状重叠的区域是孔内的填充区域,等等。

下面的示例通过将符号的每条路径添加到路径列表中,创建了一个高压符号。顶点的坐标已归一化,通过包含形状的scale 属性,路径将与包含形状一起重新缩放。

PathMultiline {
    paths: [
            [Qt.point(0.5,     0.06698),
             Qt.point(1,       0.93301),
             Qt.point(0,       0.93301),
             Qt.point(0.5,     0.06698)],

            [Qt.point(0.5,     0.12472),
             Qt.point(0.95,    0.90414),
             Qt.point(0.05,    0.90414),
             Qt.point(0.5,     0.12472)],

            [Qt.point(0.47131, 0.32986),
             Qt.point(0.36229, 0.64789),
             Qt.point(0.51492, 0.58590),
             Qt.point(0.47563, 0.76014),
             Qt.point(0.44950, 0.73590),
             Qt.point(0.46292, 0.83392),
             Qt.point(0.52162, 0.75190),
             Qt.point(0.48531, 0.76230),
             Qt.point(0.57529, 0.53189),
             Qt.point(0.41261, 0.59189),
             Qt.point(0.53001, 0.32786),
             Qt.point(0.47131, 0.32986)]
           ]
}

另请参见 Path,QPainterPath::setFillRule,PathPolyline,PathQuad,PathCubic,PathArc,PathAngleArc,PathCurve,PathSvgPathMove

属性文档

paths : list<list<point>>

此属性定义多段线的顶点。

它可以是用Qt.point() 构建的点的 JS 数组,也可以是QPolygonFQListQVector ,还可以是QVector<QVector<QPointF>>。如果要将其绑定到某个 C++ 对象中的自定义属性,QVector<QPolygonF> 或QVector<QVector<QPointF>> 是最合适的类型。


start : point [read-only]

此只读属性包含多段线的起点。


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