Qt 4.8
Functions
qpoint.cpp File Reference
#include "qpoint.h"
#include "qdatastream.h"
#include "qdebug.h"

Go to the source code of this file.

Functions

QDataStreamoperator<< (QDataStream &s, const QPoint &p)
 
QDebug operator<< (QDebug dbg, const QPoint &p)
 
QDebug operator<< (QDebug d, const QPointF &p)
 
QDataStreamoperator<< (QDataStream &s, const QPointF &p)
 
QDataStreamoperator>> (QDataStream &s, QPoint &p)
 
QDataStreamoperator>> (QDataStream &s, QPointF &p)
 

Function Documentation

◆ operator<<() [1/4]

QDataStream& operator<< ( QDataStream s,
const QPoint p 
)
related

Definition at line 435 of file qpoint.cpp.

436 {
437  if (s.version() == 1)
438  s << (qint16)p.x() << (qint16)p.y();
439  else
440  s << (qint32)p.x() << (qint32)p.y();
441  return s;
442 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ operator<<() [2/4]

QDebug operator<< ( QDebug  dbg,
const QPoint p 
)

Definition at line 495 of file qpoint.cpp.

495  {
496  dbg.nospace() << "QPoint(" << p.x() << ',' << p.y() << ')';
497  return dbg.space();
498 }
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 y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [3/4]

QDebug operator<< ( QDebug  d,
const QPointF p 
)

Definition at line 500 of file qpoint.cpp.

501 {
502  d.nospace() << "QPointF(" << p.x() << ", " << p.y() << ')';
503  return d.space();
504 }
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 x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [4/4]

QDataStream& operator<< ( QDataStream s,
const QPointF p 
)
related

Definition at line 849 of file qpoint.cpp.

850 {
851  s << double(p.x()) << double(p.y());
852  return s;
853 }
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ operator>>() [1/2]

QDataStream& operator>> ( QDataStream s,
QPoint p 
)
related

Definition at line 457 of file qpoint.cpp.

458 {
459  if (s.version() == 1) {
460  qint16 x, y;
461  s >> x; p.rx() = x;
462  s >> y; p.ry() = y;
463  }
464  else {
465  qint32 x, y;
466  s >> x; p.rx() = x;
467  s >> y; p.ry() = y;
468  }
469  return s;
470 }
int qint32
Definition: qglobal.h:937
int & ry()
Returns a reference to the y coordinate of this point.
Definition: qpoint.h:143
short qint16
Definition: qglobal.h:935
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212

◆ operator>>() [2/2]

QDataStream& operator>> ( QDataStream s,
QPointF p 
)
related

Definition at line 868 of file qpoint.cpp.

869 {
870  double x, y;
871  s >> x;
872  s >> y;
873  p.setX(qreal(x));
874  p.setY(qreal(y));
875  return s;
876 }
double qreal
Definition: qglobal.h:1193
void setY(qreal y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qpoint.h:297
void setX(qreal x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qpoint.h:292