Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuadPath Class Reference

#include <qquadpath_p.h>

+ Collaboration diagram for QQuadPath:

Classes

class  Element
 

Public Types

enum  PathHint : quint8 {
  PathLinear = 0x1 , PathQuadratic = 0x2 , PathConvex = 0x4 , PathFillOnRight = 0x8 ,
  PathSolid = 0x10 , PathNonIntersecting = 0x20 , PathNonOverlappingControlPointTriangles = 0x40
}
 

Public Member Functions

void moveTo (const QVector2D &to)
 
void lineTo (const QVector2D &to)
 
void quadTo (const QVector2D &control, const QVector2D &to)
 
ElementelementAt (int i)
 
const ElementelementAt (int i) const
 
int indexOfChildAt (int i, int childNumber) const
 
QRectF controlPointRect () const
 
Qt::FillRule fillRule () const
 
void setFillRule (Qt::FillRule rule)
 
void reserve (int size)
 
int elementCount () const
 
bool isEmpty () const
 
int elementCountRecursive () const
 
QPainterPath toPainterPath () const
 
QString asSvgString () const
 
QQuadPath subPathsClosed (bool *didClose=nullptr) const
 
void addCurvatureData ()
 
QQuadPath flattened () const
 
QQuadPath dashed (qreal lineWidth, const QList< qreal > &dashPattern, qreal dashOffset=0) const
 
void splitElementAt (int index)
 
bool contains (const QVector2D &point) const
 
bool contains (const QVector2D &point, int fromIndex, int toIndex) const
 
Element::FillSide fillSideOf (int elementIdx, float elementT) const
 
template<typename Func >
void iterateChildrenOf (Element &e, Func &&lambda)
 
template<typename Func >
void iterateChildrenOf (const Element &e, Func &&lambda) const
 
template<typename Func >
void iterateElements (Func &&lambda)
 
template<typename Func >
void iterateElements (Func &&lambda) const
 
bool testHint (PathHint hint) const
 
void setHint (PathHint hint, bool on=true)
 
PathHints pathHints () const
 
void setPathHints (PathHints newHints)
 

Static Public Member Functions

static QQuadPath fromPainterPath (const QPainterPath &path, PathHints hints={})
 
static QVector2D closestPointOnLine (const QVector2D &p, const QVector2D &sp, const QVector2D &ep)
 
static bool isPointOnLeft (const QVector2D &p, const QVector2D &sp, const QVector2D &ep)
 
static bool isPointOnLine (const QVector2D &p, const QVector2D &sp, const QVector2D &ep)
 
static bool isPointNearLine (const QVector2D &p, const QVector2D &sp, const QVector2D &ep)
 

Friends

class QSGCurveProcessor
 
Q_QUICK_EXPORT QDebug operator<< (QDebug, const QQuadPath &)
 

Detailed Description

Definition at line 27 of file qquadpath_p.h.

Member Enumeration Documentation

◆ PathHint

Enumerator
PathLinear 
PathQuadratic 
PathConvex 
PathFillOnRight 
PathSolid 
PathNonIntersecting 
PathNonOverlappingControlPointTriangles 

Definition at line 31 of file qquadpath_p.h.

Member Function Documentation

◆ addCurvatureData()

void QQuadPath::addCurvatureData ( )

Definition at line 543 of file qquadpath.cpp.

References PathFillOnRight, Q_ASSERT, qDebug, qEnvironmentVariableIntValue(), and testHint().

Referenced by QQuickGenerator::optimizePaths().

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

◆ asSvgString()

QString QQuadPath::asSvgString ( ) const

Definition at line 632 of file qquadpath.cpp.

References str.

◆ closestPointOnLine()

QVector2D QQuadPath::closestPointOnLine ( const QVector2D & p,
const QVector2D & sp,
const QVector2D & ep )
static

Definition at line 313 of file qquadpath.cpp.

References QVector2D::dotProduct(), line, qBound(), and sp.

+ Here is the call graph for this function:

◆ contains() [1/2]

bool QQuadPath::contains ( const QVector2D & point) const

Definition at line 321 of file qquadpath.cpp.

Referenced by operator<<().

+ Here is the caller graph for this function:

◆ contains() [2/2]

bool QQuadPath::contains ( const QVector2D & point,
int fromIndex,
int toIndex ) const

Definition at line 326 of file qquadpath.cpp.

References QList< T >::at(), QQuadPath::Element::controlPoint(), dir, QQuadPath::Element::endPoint(), fillRule(), i, QQuadPath::Element::pointAtFraction(), qMax(), qMin(), qSwap(), QQuadPath::Element::startPoint(), QQuadPath::Element::tangentAtFraction(), toIndex(), Qt::WindingFill, QVector2D::x(), and QVector2D::y().

+ Here is the call graph for this function:

◆ controlPointRect()

QRectF QQuadPath::controlPointRect ( ) const

Definition at line 589 of file qquadpath.cpp.

References QList< T >::constFirst(), elementCount(), QVector2D::setX(), QVector2D::setY(), QVector2D::toPointF(), QVector2D::x(), QWidget::x, QVector2D::y(), and QWidget::y.

+ Here is the call graph for this function:

◆ dashed()

QQuadPath QQuadPath::dashed ( qreal lineWidth,
const QList< qreal > & dashPattern,
qreal dashOffset = 0 ) const

Definition at line 822 of file qquadpath.cpp.

References elementAt(), elementCount(), fillRule(), i, QQuadPath::Element::isLine(), QQuadPath::Element::isSubpathStart(), pathHints(), qMax(), and QQuadPath::Element::startPoint().

+ Here is the call graph for this function:

◆ elementAt() [1/2]

Element & QQuadPath::elementAt ( int i)
inline

Definition at line 204 of file qquadpath_p.h.

References i.

Referenced by dashed(), QSGCurveProcessor::processFill(), and splitElementAt().

+ Here is the caller graph for this function:

◆ elementAt() [2/2]

const Element & QQuadPath::elementAt ( int i) const
inline

Definition at line 209 of file qquadpath_p.h.

References i.

◆ elementCount()

int QQuadPath::elementCount ( ) const
inline

Definition at line 225 of file qquadpath_p.h.

Referenced by controlPointRect(), dashed(), fillSideOf(), operator<<(), subPathsClosed(), and toPainterPath().

+ Here is the caller graph for this function:

◆ elementCountRecursive()

int QQuadPath::elementCountRecursive ( ) const

Definition at line 608 of file qquadpath.cpp.

References iterateElements().

Referenced by flattened().

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

◆ fillRule()

Qt::FillRule QQuadPath::fillRule ( ) const
inline

Definition at line 221 of file qquadpath_p.h.

References Qt::OddEvenFill, and Qt::WindingFill.

Referenced by contains(), dashed(), fillSideOf(), flattened(), and toPainterPath().

+ Here is the caller graph for this function:

◆ fillSideOf()

QQuadPath::Element::FillSide QQuadPath::fillSideOf ( int elementIdx,
float elementT ) const

Definition at line 377 of file qquadpath.cpp.

References QList< T >::at(), QQuadPath::Element::controlPoint(), dir, elementCount(), QQuadPath::Element::endPoint(), fillRule(), i, j, QQuadPath::Element::pointAtFraction(), qAbs(), qMax(), qMin(), qSwap(), QQuadPath::Element::startPoint(), QQuadPath::Element::tangentAtFraction(), Qt::WindingFill, QVector2D::x(), and QVector2D::y().

+ Here is the call graph for this function:

◆ flattened()

QQuadPath QQuadPath::flattened ( ) const

Definition at line 700 of file qquadpath.cpp.

References elementCountRecursive(), fillRule(), iterateElements(), pathHints(), and reserve().

+ Here is the call graph for this function:

◆ fromPainterPath()

QQuadPath QQuadPath::fromPainterPath ( const QPainterPath & path,
PathHints hints = {} )
static

Definition at line 492 of file qquadpath.cpp.

References QPainterPath::CurveToElement, QBezier::fromPoints(), i, QPainterPath::LineToElement, QPainterPath::MoveToElement, PathQuadratic, qt_toQuadratics(), reserve(), sp, and QPainterPath::Element::type.

Referenced by QQuickGenerator::optimizePaths(), and QSGCurveGlyphAtlas::populate().

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

◆ indexOfChildAt()

int QQuadPath::indexOfChildAt ( int i,
int childNumber ) const
inline

Definition at line 214 of file qquadpath_p.h.

References i.

◆ isEmpty()

bool QQuadPath::isEmpty ( ) const
inline

Definition at line 226 of file qquadpath_p.h.

◆ isPointNearLine()

bool QQuadPath::isPointNearLine ( const QVector2D & p,
const QVector2D & sp,
const QVector2D & ep )
static

Definition at line 301 of file qquadpath.cpp.

References QVector2D::dotProduct(), epsilon, and sp.

+ Here is the call graph for this function:

◆ isPointOnLeft()

bool QQuadPath::isPointOnLeft ( const QVector2D & p,
const QVector2D & sp,
const QVector2D & ep )
static

Definition at line 289 of file qquadpath.cpp.

References crossProduct(), and sp.

Referenced by QSGCurveProcessor::processFill().

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

◆ isPointOnLine()

bool QQuadPath::isPointOnLine ( const QVector2D & p,
const QVector2D & sp,
const QVector2D & ep )
static

Definition at line 295 of file qquadpath.cpp.

References crossProduct(), qFuzzyIsNull(), and sp.

+ Here is the call graph for this function:

◆ iterateChildrenOf() [1/2]

template<typename Func >
void QQuadPath::iterateChildrenOf ( const Element & e,
Func && lambda ) const
inline

Definition at line 256 of file qquadpath_p.h.

References QQuadPath::Element::childCount(), and i.

+ Here is the call graph for this function:

◆ iterateChildrenOf() [2/2]

template<typename Func >
void QQuadPath::iterateChildrenOf ( Element & e,
Func && lambda )
inline

Definition at line 243 of file qquadpath_p.h.

References QQuadPath::Element::childCount(), and i.

+ Here is the call graph for this function:

◆ iterateElements() [1/2]

template<typename Func >
void QQuadPath::iterateElements ( Func && lambda)
inline

Definition at line 269 of file qquadpath_p.h.

References QQuadPath::Element::childCount(), and i.

Referenced by elementCountRecursive(), flattened(), and QSGCurveProcessor::processFill().

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

◆ iterateElements() [2/2]

template<typename Func >
void QQuadPath::iterateElements ( Func && lambda) const
inline

Definition at line 281 of file qquadpath_p.h.

References QQuadPath::Element::childCount(), and i.

+ Here is the call graph for this function:

◆ lineTo()

void QQuadPath::lineTo ( const QVector2D & to)
inline

Definition at line 194 of file qquadpath_p.h.

◆ moveTo()

void QQuadPath::moveTo ( const QVector2D & to)
inline

Definition at line 188 of file qquadpath_p.h.

◆ pathHints()

PathHints QQuadPath::pathHints ( ) const
inline

Definition at line 307 of file qquadpath_p.h.

Referenced by dashed(), and flattened().

+ Here is the caller graph for this function:

◆ quadTo()

void QQuadPath::quadTo ( const QVector2D & control,
const QVector2D & to )
inline

Definition at line 199 of file qquadpath_p.h.

◆ reserve()

void QQuadPath::reserve ( int size)
inline

Definition at line 224 of file qquadpath_p.h.

Referenced by flattened(), and fromPainterPath().

+ Here is the caller graph for this function:

◆ setFillRule()

void QQuadPath::setFillRule ( Qt::FillRule rule)
inline

Definition at line 222 of file qquadpath_p.h.

References rule, and Qt::WindingFill.

◆ setHint()

void QQuadPath::setHint ( PathHint hint,
bool on = true )
inline

Definition at line 302 of file qquadpath_p.h.

References hint().

+ Here is the call graph for this function:

◆ setPathHints()

void QQuadPath::setPathHints ( PathHints newHints)
inline

Definition at line 312 of file qquadpath_p.h.

Referenced by QSGCurveProcessor::removeNestedSubpaths().

+ Here is the caller graph for this function:

◆ splitElementAt()

void QQuadPath::splitElementAt ( int index)

Definition at line 879 of file qquadpath.cpp.

References elementAt(), QQuadPath::Element::midPoint(), qCDebug, qFuzzyCompare(), QList< T >::resize(), and QList< T >::size().

+ Here is the call graph for this function:

◆ subPathsClosed()

QQuadPath QQuadPath::subPathsClosed ( bool * didClose = nullptr) const

Definition at line 652 of file qquadpath.cpp.

References QList< T >::append(), QList< T >::at(), elementCount(), i, QList< T >::isEmpty(), QList< T >::last(), Q_ASSERT, and sp.

Referenced by QQuickGenerator::optimizePaths().

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

◆ testHint()

bool QQuadPath::testHint ( PathHint hint) const
inline

Definition at line 297 of file qquadpath_p.h.

References hint().

Referenced by addCurvatureData().

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

◆ toPainterPath()

QPainterPath QQuadPath::toPainterPath ( ) const

Definition at line 615 of file qquadpath.cpp.

References elementCount(), fillRule(), and QPainterPath::reserve().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

Q_QUICK_EXPORT QDebug operator<< ( QDebug ,
const QQuadPath &  )
friend

Definition at line 933 of file qquadpath.cpp.

◆ QSGCurveProcessor

friend class QSGCurveProcessor
friend

Definition at line 331 of file qquadpath_p.h.


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