Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickpath.cpp File Reference
#include "qquickpath_p.h"
#include "qquickpath_p_p.h"
#include "qquicksvgparser_p.h"
#include <QSet>
#include <QTime>
#include <private/qbezier_p.h>
#include <QtCore/qmath.h>
#include <QtCore/private/qnumeric_p.h>
#include "moc_qquickpath_p.cpp"
+ Include dependency graph for qquickpath.cpp:

Go to the source code of this file.

Functions

static QQuickPathPrivateprivatePath (QObject *object)
 
static void scalePath (QPainterPath &path, const QSizeF &scale)
 
static QBezier nextBezier (const QPainterPath &path, int *current, qreal *bezLength, bool reverse=false)
 
static int segmentCount (const QPainterPath &path, qreal pathLength)
 
static qreal slopeAt (qreal t, qreal a, qreal b, qreal c, qreal d)
 
QPointF positionForCurve (const QQuickPathData &data, const QPointF &prevPoint)
 \qmltype PathLine \instantiates QQuickPathLine \inqmlmodule QtQuick
 
QPointF previousPathPosition (const QPainterPath &path)
 \qmltype PathCurve \instantiates QQuickPathCatmullRomCurve \inqmlmodule QtQuick
 

Function Documentation

◆ nextBezier()

static QBezier nextBezier ( const QPainterPath path,
int *  current,
qreal bezLength,
bool  reverse = false 
)
inlinestatic

Definition at line 603 of file qquickpath.cpp.

References QPainterPath::CurveToElement, e, QBezier::fromPoints(), i, QString::length(), line, QPainterPath::LineToElement, and QPainterPath::MoveToElement.

+ Here is the call graph for this function:

◆ positionForCurve()

QPointF positionForCurve ( const QQuickPathData data,
const QPointF prevPoint 
)
inline

\qmltype PathLine \instantiates QQuickPathLine \inqmlmodule QtQuick

Defines a straight line.

The example below creates a path consisting of a straight line from 0,100 to 200,100:

\qml Path { startX: 0; startY: 100 PathLine { x: 200; y: 100 } } \endqml

See also
Path, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, PathMove, PathPolyline

\qmlproperty real QtQuick::PathLine::x \qmlproperty real QtQuick::PathLine::y

Defines the end point of the line.

See also
relativeX, relativeY

\qmlproperty real QtQuick::PathLine::relativeX \qmlproperty real QtQuick::PathLine::relativeY

Defines the end point of the line relative to its start.

If both a relative and absolute end position are specified for a single axis, the relative position will be used.

Relative and absolute positions can be mixed, for example it is valid to set a relative x and an absolute y.

See also
x, y

Definition at line 1221 of file qquickpath.cpp.

References QQuickCurve::hasRelativeX(), QQuickCurve::hasRelativeY(), QQuickCurve::hasX(), QQuickCurve::hasY(), QQuickCurve::relativeX, QQuickCurve::relativeY, QPointF::x(), QQuickCurve::x, QPointF::y(), and QQuickCurve::y.

Referenced by QQuickPathLine::addToPath(), QQuickPathMove::addToPath(), QQuickPathQuad::addToPath(), QQuickPathCubic::addToPath(), QQuickPathCatmullRomCurve::addToPath(), and QQuickPathArc::addToPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ previousPathPosition()

QPointF previousPathPosition ( const QPainterPath path)
inline

\qmltype PathCurve \instantiates QQuickPathCatmullRomCurve \inqmlmodule QtQuick

Defines a point on a Catmull-Rom curve.

PathCurve provides an easy way to specify a curve passing directly through a set of points. Typically multiple PathCurves are used in a series, as the following example demonstrates:

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();
}
}

This example produces the following path (with the starting point and PathCurve points highlighted in red):

See also
Path, PathLine, PathQuad, PathCubic, PathArc, PathSvg

\qmlproperty real QtQuick::PathCurve::x \qmlproperty real QtQuick::PathCurve::y

Defines the end point of the curve.

See also
relativeX, relativeY

\qmlproperty real QtQuick::PathCurve::relativeX \qmlproperty real QtQuick::PathCurve::relativeY

Defines the end point of the curve relative to its start.

If both a relative and absolute end position are specified for a single axis, the relative position will be used.

Relative and absolute positions can be mixed, for example it is valid to set a relative x and an absolute y.

See also
x, y

Definition at line 1714 of file qquickpath.cpp.

References QPainterPath::CurveToDataElement.

Referenced by QQuickPathCatmullRomCurve::addToPath().

+ Here is the caller graph for this function:

◆ privatePath()

static QQuickPathPrivate * privatePath ( QObject object)
static

Definition at line 231 of file qquickpath.cpp.

References QQuickPathPrivate::get().

Referenced by QQuickPath::pathElements_append(), QQuickPath::pathElements_at(), QQuickPath::pathElements_clear(), and QQuickPath::pathElements_count().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scalePath()

static void scalePath ( QPainterPath path,
const QSizeF scale 
)
inlinestatic

Definition at line 381 of file qquickpath.cpp.

References i, QPainterPath::Element::x, and QPainterPath::Element::y.

Referenced by QQuickPath::createPath(), and QQuickPath::createShapePath().

+ Here is the caller graph for this function:

◆ segmentCount()

static int segmentCount ( const QPainterPath path,
qreal  pathLength 
)
inlinestatic

Definition at line 641 of file qquickpath.cpp.

References QPainterPath::LineToElement, QPainterPath::MoveToElement, and qCeil().

Referenced by QVersionNumber::isPrefixOf(), QSSGParticleBuffer::resizeLine(), QVersionNumber::segments(), and QSSGParticleRenderer::updateUniformsForParticles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ slopeAt()

static qreal slopeAt ( qreal  t,
qreal  a,
qreal  b,
qreal  c,
qreal  d 
)
inlinestatic

Definition at line 656 of file qquickpath.cpp.

References d.