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

QDataStream & operator>> ( QDataStream stream,
QPainterPath path 
) [friend]

Reads a painter path from the given stream into the specified path, and returns a reference to the stream.

See also:
{Format of the QDataStream Operators}

Definition at line 2177 of file qpainterpath.cpp.

{
    int size;
    s >> size;

    if (size == 0)
        return s;

    p.ensureData(); // in case if p.d_func() == 0
    if (p.d_func()->elements.size() == 1) {
        Q_ASSERT(p.d_func()->elements.at(0).type == QPainterPath::MoveToElement);
        p.d_func()->elements.clear();
    }
    p.d_func()->elements.reserve(p.d_func()->elements.size() + size);
    for (int i=0; i<size; ++i) {
        int type;
        double x, y;
        s >> type;
        s >> x;
        s >> y;
        Q_ASSERT(type >= 0 && type <= 3);
#ifndef QT_NO_DEBUG
        if (qt_is_nan(x) || qt_is_nan(y))
            qWarning("QDataStream::operator>>: Adding a NaN element to path, results are undefined");
#endif
        QPainterPath::Element elm = { x, y, QPainterPath::ElementType(type) };
        p.d_func()->elements.append(elm);
    }
    s >> p.d_func()->cStart;
    int fillRule;
    s >> fillRule;
    Q_ASSERT(fillRule == Qt::OddEvenFill || Qt::WindingFill);
    p.d_func()->fillRule = Qt::FillRule(fillRule);
    p.d_func()->dirtyBounds = true;
    p.d_func()->dirtyControlBounds = true;
    return s;
}


Generated by  Doxygen 1.6.0   Back to index