Qt 4.8
Classes | Functions
qrect.h File Reference
#include <QtCore/qsize.h>
#include <QtCore/qpoint.h>

Go to the source code of this file.

Classes

class  QRect
 The QRect class defines a rectangle in the plane using integer precision. More...
 
class  QRectF
 The QRectF class defines a rectangle in the plane using floating point precision. More...
 

Functions

Q_CORE_EXPORT_INLINE bool operator!= (const QRect &, const QRect &)
 
Q_CORE_EXPORT_INLINE bool operator!= (const QRectF &, const QRectF &)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QRect &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QRect &)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QRectF &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QRectF &)
 
Q_CORE_EXPORT_INLINE bool operator== (const QRect &, const QRect &)
 
Q_CORE_EXPORT_INLINE bool operator== (const QRectF &, const QRectF &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QRect &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QRectF &)
 
 Q_DECLARE_TYPEINFO (QRect, Q_MOVABLE_TYPE)
 
 Q_DECLARE_TYPEINFO (QRectF, Q_MOVABLE_TYPE)
 

Function Documentation

◆ operator!=() [1/2]

bool operator!= ( const QRect r1,
const QRect r2 
)
inline

Definition at line 501 of file qrect.h.

502 {
503  return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
504 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator!=() [2/2]

bool operator!= ( const QRectF r1,
const QRectF r2 
)
inline

Definition at line 839 of file qrect.h.

840 {
841  return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp)
842  || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h);
843 }
qreal xp
Definition: qrect.h:606
qreal h
Definition: qrect.h:609
qreal w
Definition: qrect.h:608
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172
qreal yp
Definition: qrect.h:607

◆ operator<<() [1/4]

Q_CORE_EXPORT QDataStream& operator<< ( QDataStream ,
const QRect  
)
related

Definition at line 1512 of file qrect.cpp.

1513 {
1514  if (s.version() == 1)
1515  s << (qint16)r.left() << (qint16)r.top()
1516  << (qint16)r.right() << (qint16)r.bottom();
1517  else
1518  s << (qint32)r.left() << (qint32)r.top()
1519  << (qint32)r.right() << (qint32)r.bottom();
1520  return s;
1521 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator<<() [2/4]

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QRect  
)

Definition at line 1555 of file qrect.cpp.

1555  {
1556  dbg.nospace() << "QRect(" << r.x() << ',' << r.y() << ' '
1557  << r.width() << 'x' << r.height() << ')';
1558  return dbg.space();
1559 }

◆ operator<<() [3/4]

Q_CORE_EXPORT QDataStream& operator<< ( QDataStream ,
const QRectF  
)
related

Definition at line 2879 of file qrect.cpp.

2880 {
2881  s << double(r.x()) << double(r.y()) << double(r.width()) << double(r.height());
2882  return s;
2883 }

◆ operator<<() [4/4]

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QRectF  
)

Definition at line 2914 of file qrect.cpp.

2914  {
2915  dbg.nospace() << "QRectF(" << r.x() << ',' << r.y() << ' '
2916  << r.width() << 'x' << r.height() << ')';
2917  return dbg.space();
2918 }

◆ operator==() [1/2]

bool operator== ( const QRect r1,
const QRect r2 
)
inline

Definition at line 496 of file qrect.h.

497 {
498  return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
499 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator==() [2/2]

bool operator== ( const QRectF r1,
const QRectF r2 
)
inline

Definition at line 833 of file qrect.h.

834 {
835  return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp)
836  && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h);
837 }
qreal xp
Definition: qrect.h:606
qreal h
Definition: qrect.h:609
qreal w
Definition: qrect.h:608
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172
qreal yp
Definition: qrect.h:607

◆ operator>>() [1/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QRect  
)
related

Definition at line 1536 of file qrect.cpp.

1537 {
1538  if (s.version() == 1) {
1539  qint16 x1, y1, x2, y2;
1540  s >> x1; s >> y1; s >> x2; s >> y2;
1541  r.setCoords(x1, y1, x2, y2);
1542  }
1543  else {
1544  qint32 x1, y1, x2, y2;
1545  s >> x1; s >> y1; s >> x2; s >> y2;
1546  r.setCoords(x1, y1, x2, y2);
1547  }
1548  return s;
1549 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator>>() [2/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QRectF  
)
related

Definition at line 2899 of file qrect.cpp.

2900 {
2901  double x, y, w, h;
2902  s >> x;
2903  s >> y;
2904  s >> w;
2905  s >> h;
2906  r.setRect(qreal(x), qreal(y), qreal(w), qreal(h));
2907  return s;
2908 }
double qreal
Definition: qglobal.h:1193

◆ Q_DECLARE_TYPEINFO() [1/2]

Q_DECLARE_TYPEINFO ( QRect  ,
Q_MOVABLE_TYPE   
)

◆ Q_DECLARE_TYPEINFO() [2/2]

Q_DECLARE_TYPEINFO ( QRectF  ,
Q_MOVABLE_TYPE   
)