853bool QRect::contains(
const QRect &r,
bool proper)
const noexcept
855 if (isNull() || r.isNull())
858 Representation l1 = x1;
859 Representation r1 = x1 - 1;
865 Representation l2 = r.x1;
866 Representation r2 = r.x1 - 1;
873 if (l2 <= l1 || r2 >= r1)
876 if (l2 < l1 || r2 > r1)
880 Representation t1 = y1;
881 Representation b1 = y1 - 1;
887 Representation t2 = r.y1;
888 Representation b2 = r.y1 - 1;
895 if (t2 <= t1 || b2 >= b1)
898 if (t2 < t1 || b2 > b1)
931QRect QRect::operator|(
const QRect &r)
const noexcept
938 Representation l1 = x1;
939 Representation r1 = x1 - 1;
945 Representation l2 = r.x1;
946 Representation r2 = r.x1 - 1;
952 Representation t1 = y1;
953 Representation b1 = y1 - 1;
959 Representation t2 = r.y1;
960 Representation b2 = r.y1 - 1;
967 tmp.x1 = qMin(l1, l2);
968 tmp.x2 = qMax(r1, r2);
969 tmp.y1 = qMin(t1, t2);
970 tmp.y2 = qMax(b1, b2);
1227QDataStream &operator<<(QDataStream &s,
const QRect &r)
1229 if (s.version() == 1)
1230 s << (qint16)r.left() << (qint16)r.top()
1231 << (qint16)r.right() << (qint16)r.bottom();
1233 s << (qint32)r.left() << (qint32)r.top()
1234 << (qint32)r.right() << (qint32)r.bottom();
1250 if (s.version() == 1) {
1251 qint16 x1, y1, x2, y2;
1252 s >> x1; s >> y1; s >> x2; s >> y2;
1253 r.setCoords(x1, y1, x2, y2);
1256 qint32 x1, y1, x2, y2;
1257 s >> x1; s >> y1; s >> x2; s >> y2;
1258 r.setCoords(x1, y1, x2, y2);
2127QRectF QRectF::operator|(
const QRectF &r)
const noexcept
2142 left = qMin(left, r.xp + r.w);
2143 right = qMax(right, r.xp);
2145 left = qMin(left, r.xp);
2146 right = qMax(right, r.xp + r.w);
2157 top = qMin(top, r.yp + r.h);
2158 bottom = qMax(bottom, r.yp);
2160 top = qMin(top, r.yp);
2161 bottom = qMax(bottom, r.yp + r.h);
2164 return QRectF(left, top, right - left, bottom - top);