Qt 4.8
Functions
qvector2d.cpp File Reference
#include "qvector2d.h"
#include "qvector3d.h"
#include "qvector4d.h"
#include <QtCore/qdebug.h>
#include <QtCore/qvariant.h>
#include <QtCore/qmath.h>

Go to the source code of this file.

Functions

QDebug operator<< (QDebug dbg, const QVector2D &vector)
 
QDataStreamoperator<< (QDataStream &stream, const QVector2D &vector)
 
QDataStreamoperator>> (QDataStream &stream, QVector2D &vector)
 

Function Documentation

◆ operator<<() [1/2]

QDebug operator<< ( QDebug  dbg,
const QVector2D vector 
)

Definition at line 488 of file qvector2d.cpp.

489 {
490  dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
491  return dbg.space();
492 }
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: qvector2d.h:146
qreal y() const
Returns the y coordinate of this point.
Definition: qvector2d.h:147
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [2/2]

QDataStream& operator<< ( QDataStream stream,
const QVector2D vector 
)
related

Definition at line 511 of file qvector2d.cpp.

512 {
513  stream << double(vector.x()) << double(vector.y());
514  return stream;
515 }
static FILE * stream
qreal x() const
Returns the x coordinate of this point.
Definition: qvector2d.h:146
qreal y() const
Returns the y coordinate of this point.
Definition: qvector2d.h:147

◆ operator>>()

QDataStream& operator>> ( QDataStream stream,
QVector2D vector 
)
related

Definition at line 530 of file qvector2d.cpp.

531 {
532  double x, y;
533  stream >> x;
534  stream >> y;
535  vector.setX(qreal(x));
536  vector.setY(qreal(y));
537  return stream;
538 }
double qreal
Definition: qglobal.h:1193
void setX(qreal x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qvector2d.h:149
static FILE * stream
void setY(qreal y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qvector2d.h:150