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

bool QPainterPath::operator== ( const QPainterPath path  )  const

Returns true if this painterpath is equal to the given path.

Note that comparing paths may involve a per element comparison which can be slow for complex paths.

See also:

Definition at line 2096 of file qpainterpath.cpp.

References boundingRect(), d_func(), QSizeF::rheight(), QSizeF::rwidth(), and QRectF::size().

    QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func());
    if (path.d_func() == d)
        return true;
    else if (!d || !path.d_func())
        return false;
    else if (d->fillRule != path.d_func()->fillRule)
        return false;
    else if (d->elements.size() != path.d_func()->elements.size())
        return false;

    const qreal qt_epsilon = sizeof(qreal) == sizeof(double) ? 1e-12 : qreal(1e-5);

    QSizeF epsilon = boundingRect().size();
    epsilon.rwidth() *= qt_epsilon;
    epsilon.rheight() *= qt_epsilon;

    for (int i = 0; i < d->elements.size(); ++i)
        if (d->elements.at(i).type != path.d_func()->elements.at(i).type
            || !epsilonCompare(d->elements.at(i), path.d_func()->elements.at(i), epsilon))
            return false;

    return true;

Generated by  Doxygen 1.6.0   Back to index