Qt 4.8
Functions
qrect.cpp File Reference
#include "qrect.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "qmath.h"
#include <math.h>

Go to the source code of this file.

Functions

QDataStreamoperator<< (QDataStream &s, const QRect &r)
 
QDebug operator<< (QDebug dbg, const QRect &r)
 
QDataStreamoperator<< (QDataStream &s, const QRectF &r)
 
QDebug operator<< (QDebug dbg, const QRectF &r)
 
QDataStreamoperator>> (QDataStream &s, QRect &r)
 
QDataStreamoperator>> (QDataStream &s, QRectF &r)
 

Function Documentation

◆ operator<<() [1/4]

QDataStream& operator<< ( QDataStream s,
const QRect r 
)
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
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
short qint16
Definition: qglobal.h:935
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246

◆ operator<<() [2/4]

QDebug operator<< ( QDebug  dbg,
const QRect r 
)

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 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [3/4]

QDataStream& operator<< ( QDataStream s,
const QRectF r 
)
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 }
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664

◆ operator<<() [4/4]

QDebug operator<< ( QDebug  dbg,
const QRectF r 
)

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 }
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator>>() [1/2]

QDataStream& operator>> ( QDataStream s,
QRect r 
)
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
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212

◆ operator>>() [2/2]

QDataStream& operator>> ( QDataStream s,
QRectF r 
)
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
void setRect(qreal x, qreal y, qreal w, qreal h)
Sets the coordinates of the rectangle&#39;s top-left corner to (x, y), and its size to the given width an...
Definition: qrect.h:754