Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QPainterPath::cubicTo ( const QPointF c1,
const QPointF c2,
const QPointF endPoint 

Adds a cubic Bezier curve between the current position and the given endPoint using the control points specified by c1, and c2.

After the curve is added, the current position is updated to be at the end point of the curve.

100% qpainterpath-cubicto.png

        QLinearGradient myGradient;
        QPen myPen;

        QPainterPath myPath;
        myPath.cubicto(c1, c2, endPoint);

        QPainter painter(this);

See also:
quadTo(), {QPainterPath::Composing a QPainterPath}{Composing a QPainterPath}

Definition at line 705 of file qpainterpath.cpp.

References QPointF::x(), and QPointF::y().

Referenced by addEllipse(), arcTo(), cubicTo(), QPicture::exec(), quadTo(), and toReversed().

#ifdef QPP_DEBUG
    printf("QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n",
           c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y());
#ifndef QT_NO_DEBUG
    if (qt_is_nan(c1.x()) || qt_is_nan(c1.y()) || qt_is_nan(c2.x()) || qt_is_nan(c2.y())
        || qt_is_nan(e.x()) || qt_is_nan(e.y()))
        qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN, results are undefined");

    QPainterPathData *d = d_func();

    // Abort on empty curve as a stroker cannot handle this and the
    // curve is irrelevant anyway.
    if (d->elements.last() == c1 && c1 == c2 && c2 == e)


    Element ce1 = { c1.x(), c1.y(), CurveToElement };
    Element ce2 = { c2.x(), c2.y(), CurveToDataElement };
    Element ee = { e.x(), e.y(), CurveToDataElement };
    d->elements << ce1 << ce2 << ee;

Generated by  Doxygen 1.6.0   Back to index