PathMultiline QML Type

Defines a set of polylines through a list of lists of coordinates. More...

Import Statement: import QtQuick
Since: QtQuick 2.14

Properties

Detailed Description

This element allows to define a list of polylines at once. Each polyline in the list will be preceded by a moveTo command, effectively making each polyline a separate one. The polylines in this list are supposed to be non-intersecting with each other. In any case, when used in conjunction with a ShapePath, the containing ShapePath's ShapePath::fillRule applies. That is, with the default OddEvenFill and non intersecting shapes, the largest shape in the list defines an area to be filled; areas where two shapes overlap are holes; areas where three shapes overlap are filled areas inside holes, etc.

The example below creates a high voltage symbol by adding each path of the symbol to the list of paths. The coordinates of the vertices are normalized, and through the containing shape's scale property, the path will be rescaled together with its containing shape.

 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)]
            ]
 }

See also Path, QPainterPath::setFillRule, PathPolyline, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, and PathMove.

Property Documentation

paths : list<list<point>>

This property defines the vertices of the polylines.

It can be a JS array of JS arrays of points constructed with Qt.point(), a QList or QVector of QPolygonF, or QVector<QVector<QPointF>>. If you are binding this to a custom property in some C++ object, QVector<QPolygonF> or QVector<QVector<QPointF>> is the most appropriate type to use.


start : point [read-only]

This read-only property contains the beginning of the polylines.