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

QRect QRect::operator & ( const QRect rectangle  )  const

Returns the intersection of this rectangle and the given rectangle. Returns an empty rectangle if there is no intersection.

See also:
operator&=(), intersected()

Definition at line 1016 of file qrect.cpp.

References isEmpty(), isNull(), normalized(), QRect(), x1, x2, y1, and y2.

{
    if (isNull() || r.isNull())
        return QRect();
    QRect r1 = normalized();
    QRect r2 = r.normalized();
    QRect tmp;
    tmp.x1 = qMax(r1.x1, r2.x1);
    tmp.x2 = qMin(r1.x2, r2.x2);
    tmp.y1 = qMax(r1.y1, r2.y1);
    tmp.y2 = qMin(r1.y2, r2.y2);
    return tmp.isEmpty() ? QRect() : tmp;
}


Generated by  Doxygen 1.6.0   Back to index