864bool QRect::contains(
const QRect &r,
bool proper)
const noexcept
866 if (isNull() || r.isNull())
869 Representation l1 = x1;
870 Representation r1 = x1 - 1;
876 Representation l2 = r.x1;
877 Representation r2 = r.x1 - 1;
884 if (l2 <= l1 || r2 >= r1)
887 if (l2 < l1 || r2 > r1)
891 Representation t1 = y1;
892 Representation b1 = y1 - 1;
898 Representation t2 = r.y1;
899 Representation b2 = r.y1 - 1;
906 if (t2 <= t1 || b2 >= b1)
909 if (t2 < t1 || b2 > b1)
942QRect QRect::operator|(
const QRect &r)
const noexcept
949 Representation l1 = x1;
950 Representation r1 = x1 - 1;
956 Representation l2 = r.x1;
957 Representation r2 = r.x1 - 1;
963 Representation t1 = y1;
964 Representation b1 = y1 - 1;
970 Representation t2 = r.y1;
971 Representation b2 = r.y1 - 1;
978 tmp.x1 = qMin(l1, l2);
979 tmp.x2 = qMax(r1, r2);
980 tmp.y1 = qMin(t1, t2);
981 tmp.y2 = qMax(b1, b2);
1244QDataStream &operator<<(QDataStream &s,
const QRect &r)
1246 if (s.version() == 1)
1247 s << (qint16)r.left() << (qint16)r.top()
1248 << (qint16)r.right() << (qint16)r.bottom();
1250 s << (qint32)r.left() << (qint32)r.top()
1251 << (qint32)r.right() << (qint32)r.bottom();
1267 if (s.version() == 1) {
1268 qint16 x1, y1, x2, y2;
1269 s >> x1; s >> y1; s >> x2; s >> y2;
1270 r.setCoords(x1, y1, x2, y2);
1273 qint32 x1, y1, x2, y2;
1274 s >> x1; s >> y1; s >> x2; s >> y2;
1275 r.setCoords(x1, y1, x2, y2);
2154QRectF QRectF::operator|(
const QRectF &r)
const noexcept
2169 left = qMin(left, r.xp + r.w);
2170 right = qMax(right, r.xp);
2172 left = qMin(left, r.xp);
2173 right = qMax(right, r.xp + r.w);
2184 top = qMin(top, r.yp + r.h);
2185 bottom = qMax(bottom, r.yp);
2187 top = qMin(top, r.yp);
2188 bottom = qMax(bottom, r.yp + r.h);
2191 return QRectF(left, top, right - left, bottom - top);