Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickPath Class Reference

#include <qquickpath_p.h>

Inheritance diagram for QQuickPath:
Collaboration diagram for QQuickPath:

Public Slots

void processPath ()
Public Slots inherited from QObject
void deleteLater ()
 \threadsafe

Signals

void changed ()
void startXChanged ()
void startYChanged ()
 Q_REVISION (6, 6) void simplifyChanged()
 Q_REVISION (2, 14) void scaleChanged()
 Q_REVISION (6, 9) void asynchronousChanged()
Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.

Public Member Functions

 QQuickPath (QObject *parent=nullptr)
 \qmltype PathElement \nativetype QQuickPathElement \inqmlmodule QtQuick
 ~QQuickPath () override
QQmlListProperty< QQuickPathElementpathElements ()
qreal startX () const
 \qmlproperty real QtQuick::Path::startX \qmlproperty real QtQuick::Path::startY These properties hold the starting position of the path.
void setStartX (qreal x)
bool hasStartX () const
qreal startY () const
void setStartY (qreal y)
bool hasStartY () const
bool isClosed () const
 \qmlproperty bool QtQuick::Path::closed This property holds whether the start and end of the path are identical.
QPainterPath path () const
void setPath (const QPainterPath &path)
QStringList attributes () const
qreal attributeAt (const QString &, qreal) const
 Q_REVISION (2, 14) Q_INVOKABLE QPointF pointAtPercent(qreal t) const
QPointF sequentialPointAt (qreal p, qreal *angle=nullptr) const
void invalidateSequentialHistory () const
QSizeF scale () const
 \qmlproperty size QtQuick::Path::scale
void setScale (const QSizeF &scale)
bool simplify () const
void setSimplify (bool s)
 \qmlproperty bool QtQuick::Path::simplify
bool isAsynchronous () const
 \qmlproperty bool QtQuick::Path::asynchronous
void setAsynchronous (bool a)
QPainterPath createPath (const QPointF &startPoint, const QPointF &endPoint, const QStringList &attributes, qreal &pathLength, QList< AttributePoint > &attributePoints, bool *closed=nullptr)
QPainterPath createShapePath (const QPointF &startPoint, const QPointF &endPoint, qreal &pathLength, bool *closed=nullptr)
Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
QString objectName () const
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
QBindable< QStringbindableObjectName ()
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
bool isQmlObjectType () const
 Returns whether the object has been created by the QML engine or ownership has been explicitly set via QJSEngine::setObjectOwnership().
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
QThreadthread () const
 Returns the thread in which the object lives.
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
void killTimer (int id)
 Kills the timer with timer identifier, id.
void killTimer (Qt::TimerId id)
template<typename T>
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
template<typename T>
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
template<typename T>
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const QObjectListchildren () const
 Returns a list of child objects.
void setParent (QObject *parent)
 Makes the object a child of parent.
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
bool disconnect (const QObject *receiver, const char *member=nullptr) const
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
bool setProperty (const char *name, QVariant &&value)
QVariant property (const char *name) const
 Returns the value of the object's name property.
QList< QByteArraydynamicPropertyNames () const
QBindingStoragebindingStorage ()
const QBindingStoragebindingStorage () const
QObjectparent () const
 Returns a pointer to the parent object.
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
virtual ~QQmlParserStatus ()

Static Public Member Functions

static QPointF sequentialPointAt (const QPainterPath &path, const qreal &pathLength, const QList< AttributePoint > &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle=nullptr)
Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
template<typename Func1>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)

Protected Member Functions

 QQuickPath (QQuickPathPrivate &dd, QObject *parent=nullptr)
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
void classBegin () override
 Invoked after class creation, but before any properties have been set.
void disconnectPathElements ()
void connectPathElements ()
void gatherAttributes ()
Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
int senderSignalIndex () const
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
bool isSignalConnected (const QMetaMethod &signal) const
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
virtual void connectNotify (const QMetaMethod &signal)
virtual void disconnectNotify (const QMetaMethod &signal)
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)

Static Protected Member Functions

static QQuickPathElementpathElements_at (QQmlListProperty< QQuickPathElement > *, qsizetype)
static void pathElements_append (QQmlListProperty< QQuickPathElement > *, QQuickPathElement *)
static qsizetype pathElements_count (QQmlListProperty< QQuickPathElement > *)
static void pathElements_clear (QQmlListProperty< QQuickPathElement > *)
static void pathElements_replace (QQmlListProperty< QQuickPathElement > *, qsizetype, QQuickPathElement *)
static void pathElements_removeLast (QQmlListProperty< QQuickPathElement > *)

Properties

QQmlListProperty< QQuickPathElementpathElements
 \qmlproperty list<PathElement> QtQuick::Path::pathElements This property holds the objects composing the path.
qreal startX
qreal startY
bool closed
bool simplify
FINALQSizeF scale
bool asynchronous
Properties inherited from QObject
QString objectName
 the name of this object

Friends

class QQuickPathAnimationUpdater

Additional Inherited Members

Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr

Detailed Description

Definition at line 611 of file qquickpath_p.h.

Constructor & Destructor Documentation

◆ QQuickPath() [1/2]

QQuickPath::QQuickPath ( QObject * parent = nullptr)

\qmltype PathElement \nativetype QQuickPathElement \inqmlmodule QtQuick

PathElement is the base path type.

This type is the base for all path types. It cannot be instantiated.

See also
Path, PathAttribute, PathPercent, PathLine, PathPolyline, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, PathRectangle

\qmltype Path \nativetype QQuickPath \inqmlmodule QtQuick

Defines a path for use by \l PathView and \l Shape.

A Path is composed of one or more path segments - PathLine, PathPolyline, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg.

The spacing of the items along the Path can be adjusted via a PathPercent object.

PathAttribute allows named attributes with values to be defined along the path.

Path and the other types for specifying path elements are shared between \l PathView and \l Shape. The following table provides an overview of the applicability of the various path elements:

\table \header

  • Element
  • PathView
  • Shape
  • Shape, software \row
  • PathMove
  • N/A
  • Yes
  • Yes \row
  • PathLine
  • Yes
  • Yes
  • Yes \row
  • PathPolyline
  • Yes
  • Yes
  • Yes \row
  • PathMultiline
  • Yes
  • Yes
  • Yes \row
  • PathQuad
  • Yes
  • Yes
  • Yes \row
  • PathCubic
  • Yes
  • Yes
  • Yes \row
  • PathArc
  • Yes
  • Yes
  • Yes \row
  • PathAngleArc
  • Yes
  • Yes
  • Yes \row
  • PathSvg
  • Yes
  • Yes
  • Yes \row
  • PathRectangle
  • Yes
  • Yes
  • Yes \row
  • PathAttribute
  • Yes
  • N/A
  • N/A \row
  • PathPercent
  • Yes
  • N/A
  • N/A \row
  • PathCurve
  • Yes
  • No
  • No \endtable
Note
Path is a non-visual type; it does not display anything on its own. To draw a path, use \l Shape.
See also
PathView, Shape, PathAttribute, PathPercent, PathLine, PathPolyline, PathMove, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, PathRectangle

Definition at line 181 of file qquickpath.cpp.

◆ ~QQuickPath()

QQuickPath::~QQuickPath ( )
override

Definition at line 191 of file qquickpath.cpp.

◆ QQuickPath() [2/2]

QQuickPath::QQuickPath ( QQuickPathPrivate & dd,
QObject * parent = nullptr )
protected

Definition at line 186 of file qquickpath.cpp.

Member Function Documentation

◆ attributeAt()

qreal QQuickPath::attributeAt ( const QString & name,
qreal percent ) const

Definition at line 1072 of file qquickpath.cpp.

◆ attributes()

QStringList QQuickPath::attributes ( ) const

Definition at line 679 of file qquickpath.cpp.

◆ changed

void QQuickPath::changed ( )
signal

◆ classBegin()

void QQuickPath::classBegin ( )
overrideprotectedvirtual

Invoked after class creation, but before any properties have been set.

Implements QQmlParserStatus.

Definition at line 603 of file qquickpath.cpp.

◆ componentComplete()

void QQuickPath::componentComplete ( )
overrideprotectedvirtual

Invoked after the root component that caused this instantiation has completed construction.

At this point all static values and binding values have been assigned to the class.

Implements QQmlParserStatus.

Definition at line 650 of file qquickpath.cpp.

◆ connectPathElements()

void QQuickPath::connectPathElements ( )
protected

Definition at line 619 of file qquickpath.cpp.

◆ createPath()

QPainterPath QQuickPath::createPath ( const QPointF & startPoint,
const QPointF & endPoint,
const QStringList & attributes,
qreal & pathLength,
QList< AttributePoint > & attributePoints,
bool * closed = nullptr )

Definition at line 461 of file qquickpath.cpp.

◆ createShapePath()

QPainterPath QQuickPath::createShapePath ( const QPointF & startPoint,
const QPointF & endPoint,
qreal & pathLength,
bool * closed = nullptr )

Definition at line 560 of file qquickpath.cpp.

◆ disconnectPathElements()

void QQuickPath::disconnectPathElements ( )
protected

Definition at line 609 of file qquickpath.cpp.

◆ gatherAttributes()

void QQuickPath::gatherAttributes ( )
protected

Definition at line 629 of file qquickpath.cpp.

◆ hasStartX()

bool QQuickPath::hasStartX ( ) const

Definition at line 216 of file qquickpath.cpp.

◆ hasStartY()

bool QQuickPath::hasStartY ( ) const

Definition at line 238 of file qquickpath.cpp.

◆ invalidateSequentialHistory()

void QQuickPath::invalidateSequentialHistory ( ) const

Definition at line 805 of file qquickpath.cpp.

◆ isAsynchronous()

bool QQuickPath::isAsynchronous ( ) const

\qmlproperty bool QtQuick::Path::asynchronous

Since
6.9

When set to true, the path will be processed asynchronously. This is an optimization to process the path only once, after all the methods that possibly affect the path. This means that when set to true, the updated path is not available immediately after e.g. adjusting \l startX, \l scale or appending an element, only after the Qt event loop has been processed. The default value is false.

Definition at line 846 of file qquickpath.cpp.

◆ isClosed()

bool QQuickPath::isClosed ( ) const

\qmlproperty bool QtQuick::Path::closed This property holds whether the start and end of the path are identical.

Definition at line 248 of file qquickpath.cpp.

◆ path()

QPainterPath QQuickPath::path ( ) const

Definition at line 663 of file qquickpath.cpp.

◆ pathElements()

QQmlListProperty< QQuickPathElement > QQuickPath::pathElements ( )

◆ pathElements_append()

void QQuickPath::pathElements_append ( QQmlListProperty< QQuickPathElement > * property,
QQuickPathElement * pathElement )
staticprotected

Definition at line 305 of file qquickpath.cpp.

◆ pathElements_at()

QQuickPathElement * QQuickPath::pathElements_at ( QQmlListProperty< QQuickPathElement > * property,
qsizetype index )
staticprotected

Definition at line 298 of file qquickpath.cpp.

◆ pathElements_clear()

void QQuickPath::pathElements_clear ( QQmlListProperty< QQuickPathElement > * property)
staticprotected

Definition at line 318 of file qquickpath.cpp.

◆ pathElements_count()

qsizetype QQuickPath::pathElements_count ( QQmlListProperty< QQuickPathElement > * property)
staticprotected

Definition at line 311 of file qquickpath.cpp.

◆ pathElements_removeLast()

void QQuickPath::pathElements_removeLast ( QQmlListProperty< QQuickPathElement > * property)
staticprotected

Definition at line 331 of file qquickpath.cpp.

◆ pathElements_replace()

void QQuickPath::pathElements_replace ( QQmlListProperty< QQuickPathElement > * property,
qsizetype position,
QQuickPathElement * pathElement )
staticprotected

Definition at line 324 of file qquickpath.cpp.

◆ processPath

void QQuickPath::processPath ( )
slot

Definition at line 405 of file qquickpath.cpp.

◆ Q_REVISION() [1/4]

QQuickPath::Q_REVISION ( 2 ,
14  ) const

◆ Q_REVISION [2/4]

QQuickPath::Q_REVISION ( 2 ,
14  )
signal

◆ Q_REVISION [3/4]

QQuickPath::Q_REVISION ( 6 ,
6  )
signal

◆ Q_REVISION [4/4]

QQuickPath::Q_REVISION ( 6 ,
9  )
signal

◆ scale()

QSizeF QQuickPath::scale ( ) const

\qmlproperty size QtQuick::Path::scale

This property holds the scale factor for the path. The width and height of scale can be different, to achieve anisotropic scaling.

Note
Setting this property will not affect the border width.
Since
QtQuick 2.14

Definition at line 873 of file qquickpath.cpp.

◆ sequentialPointAt() [1/2]

QPointF QQuickPath::sequentialPointAt ( const QPainterPath & path,
const qreal & pathLength,
const QList< AttributePoint > & attributePoints,
QQuickCachedBezier & prevBez,
qreal p,
qreal * angle = nullptr )
static

Definition at line 895 of file qquickpath.cpp.

◆ sequentialPointAt() [2/2]

QPointF QQuickPath::sequentialPointAt ( qreal p,
qreal * angle = nullptr ) const

Definition at line 889 of file qquickpath.cpp.

◆ setAsynchronous()

void QQuickPath::setAsynchronous ( bool a)

Definition at line 852 of file qquickpath.cpp.

◆ setPath()

void QQuickPath::setPath ( const QPainterPath & path)

Definition at line 669 of file qquickpath.cpp.

◆ setScale()

void QQuickPath::setScale ( const QSizeF & scale)

Definition at line 879 of file qquickpath.cpp.

◆ setSimplify()

void QQuickPath::setSimplify ( bool s)

\qmlproperty bool QtQuick::Path::simplify

Since
6.6

When set to true, the path will be simplified. This implies merging all subpaths that intersect, creating a path where there are no self-intersections. Consecutive parallel lines will also be merged. The simplified path is intended to be used with ShapePath.OddEvenFill. Bezier curves may be flattened to line segments due to numerical instability of doing bezier curve intersections.

Definition at line 819 of file qquickpath.cpp.

◆ setStartX()

void QQuickPath::setStartX ( qreal x)

Definition at line 206 of file qquickpath.cpp.

◆ setStartY()

void QQuickPath::setStartY ( qreal y)

Definition at line 228 of file qquickpath.cpp.

◆ simplify()

bool QQuickPath::simplify ( ) const

Definition at line 831 of file qquickpath.cpp.

◆ startX()

qreal QQuickPath::startX ( ) const

\qmlproperty real QtQuick::Path::startX \qmlproperty real QtQuick::Path::startY These properties hold the starting position of the path.

Definition at line 200 of file qquickpath.cpp.

◆ startXChanged

void QQuickPath::startXChanged ( )
signal

◆ startY()

qreal QQuickPath::startY ( ) const

Definition at line 222 of file qquickpath.cpp.

◆ startYChanged

void QQuickPath::startYChanged ( )
signal

◆ QQuickPathAnimationUpdater

friend class QQuickPathAnimationUpdater
friend

Definition at line 717 of file qquickpath_p.h.

Property Documentation

◆ asynchronous

bool QQuickPath::asynchronous
readwrite

Definition at line 622 of file qquickpath_p.h.

◆ closed

bool QQuickPath::closed
read

Definition at line 619 of file qquickpath_p.h.

◆ pathElements

QQmlListProperty< QQuickPathElement > QQuickPath::pathElements
read

\qmlproperty list<PathElement> QtQuick::Path::pathElements This property holds the objects composing the path.

\qmldefault

A path can contain the following path objects: \list

  • \l PathLine - a straight line to a given position.
  • \l PathPolyline - a polyline specified as a list of coordinates.
  • \l PathMultiline - a list of polylines specified as a list of lists of coordinates.
  • \l PathQuad - a quadratic Bezier curve to a given position with a control point.
  • \l PathCubic - a cubic Bezier curve to a given position with two control points.
  • \l PathArc - an arc to a given position with a radius.
  • \l PathAngleArc - an arc specified by center point, radii, and angles.
  • \l PathSvg - a path specified as an SVG path data string.
  • \l PathRectangle - a rectangle with a given position and size
  • \l PathCurve - a point on a Catmull-Rom curve.
  • \l PathAttribute - an attribute at a given position in the path.
  • \l PathPercent - a way to spread out items along various segments of the path. \endlist
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 }
}
}

Definition at line 616 of file qquickpath_p.h.

◆ scale

FINALQSizeF QQuickPath::scale
readwrite

Definition at line 621 of file qquickpath_p.h.

◆ simplify

bool QQuickPath::simplify
readwrite

Definition at line 620 of file qquickpath_p.h.

◆ startX

qreal QQuickPath::startX
readwrite

Definition at line 617 of file qquickpath_p.h.

◆ startY

qreal QQuickPath::startY
readwrite

Definition at line 618 of file qquickpath_p.h.


The documentation for this class was generated from the following files: