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

Go to the source code of this file.

Classes

class  QPoint
 The QPoint class defines a point in the plane using integer precision. More...
 
class  QPointF
 The QPointF class defines a point in the plane using floating point precision. More...
 

Functions

bool operator!= (const QPoint &p1, const QPoint &p2)
 
bool operator!= (const QPointF &p1, const QPointF &p2)
 
const QPoint operator* (const QPoint &p, float c)
 
const QPoint operator* (const QPoint &p, double c)
 
const QPoint operator* (const QPoint &p, int c)
 
const QPoint operator* (float c, const QPoint &p)
 
const QPoint operator* (double c, const QPoint &p)
 
const QPoint operator* (int c, const QPoint &p)
 
const QPointF operator* (const QPointF &p, qreal c)
 
const QPointF operator* (qreal c, const QPointF &p)
 
const QPoint operator+ (const QPoint &p1, const QPoint &p2)
 
const QPointF operator+ (const QPointF &p1, const QPointF &p2)
 
const QPoint operator- (const QPoint &p1, const QPoint &p2)
 
const QPoint operator- (const QPoint &p)
 
const QPointF operator- (const QPointF &p1, const QPointF &p2)
 
const QPointF operator- (const QPointF &p)
 
const QPoint operator/ (const QPoint &p, qreal c)
 
const QPointF operator/ (const QPointF &p, qreal c)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QPoint &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QPoint &)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QPointF &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug d, const QPointF &p)
 
bool operator== (const QPoint &p1, const QPoint &p2)
 
bool operator== (const QPointF &p1, const QPointF &p2)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QPoint &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QPointF &)
 
 Q_DECLARE_TYPEINFO (QPoint, Q_MOVABLE_TYPE)
 
 Q_DECLARE_TYPEINFO (QPointF, Q_MOVABLE_TYPE)
 

Function Documentation

◆ operator!=() [1/2]

bool operator!= ( const QPoint p1,
const QPoint p2 
)
inline

Definition at line 164 of file qpoint.h.

165 { return p1.xp != p2.xp || p1.yp != p2.yp; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator!=() [2/2]

bool operator!= ( const QPointF p1,
const QPointF p2 
)
inline

Definition at line 334 of file qpoint.h.

335 {
336  return !qFuzzyIsNull(p1.xp - p2.xp) || !qFuzzyIsNull(p1.yp - p2.yp);
337 }
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043

◆ operator*() [1/8]

const QPoint operator* ( const QPoint p,
float  c 
)
inline

Definition at line 173 of file qpoint.h.

174 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [2/8]

const QPoint operator* ( const QPoint p,
double  c 
)
inline

Definition at line 176 of file qpoint.h.

177 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [3/8]

const QPoint operator* ( const QPoint p,
int  c 
)
inline

Definition at line 179 of file qpoint.h.

180 { return QPoint(p.xp*c, p.yp*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97

◆ operator*() [4/8]

const QPoint operator* ( float  c,
const QPoint p 
)
inline

Definition at line 182 of file qpoint.h.

183 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [5/8]

const QPoint operator* ( double  c,
const QPoint p 
)
inline

Definition at line 185 of file qpoint.h.

186 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [6/8]

const QPoint operator* ( int  c,
const QPoint p 
)
inline

Definition at line 188 of file qpoint.h.

189 { return QPoint(p.xp*c, p.yp*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97

◆ operator*() [7/8]

const QPointF operator* ( const QPointF p,
qreal  c 
)
inline

Definition at line 349 of file qpoint.h.

350 {
351  return QPointF(p.xp*c, p.yp*c);
352 }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator*() [8/8]

const QPointF operator* ( qreal  c,
const QPointF p 
)
inline

Definition at line 354 of file qpoint.h.

355 {
356  return QPointF(p.xp*c, p.yp*c);
357 }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator+() [1/2]

const QPoint operator+ ( const QPoint p1,
const QPoint p2 
)
inline

Definition at line 167 of file qpoint.h.

168 { return QPoint(p1.xp+p2.xp, p1.yp+p2.yp); }
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97

◆ operator+() [2/2]

const QPointF operator+ ( const QPointF p1,
const QPointF p2 
)
inline

Definition at line 339 of file qpoint.h.

340 {
341  return QPointF(p1.xp+p2.xp, p1.yp+p2.yp);
342 }
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator-() [1/4]

const QPoint operator- ( const QPoint p1,
const QPoint p2 
)
inline

Definition at line 170 of file qpoint.h.

171 { return QPoint(p1.xp-p2.xp, p1.yp-p2.yp); }
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97

◆ operator-() [2/4]

const QPoint operator- ( const QPoint p)
inline

Definition at line 191 of file qpoint.h.

192 { return QPoint(-p.xp, -p.yp); }
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97

◆ operator-() [3/4]

const QPointF operator- ( const QPointF p1,
const QPointF p2 
)
inline

Definition at line 344 of file qpoint.h.

345 {
346  return QPointF(p1.xp-p2.xp, p1.yp-p2.yp);
347 }
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator-() [4/4]

const QPointF operator- ( const QPointF p)
inline

Definition at line 359 of file qpoint.h.

360 {
361  return QPointF(-p.xp, -p.yp);
362 }
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator/() [1/2]

const QPoint operator/ ( const QPoint p,
qreal  c 
)
inline

Definition at line 201 of file qpoint.h.

202 {
203  return QPoint(qRound(p.xp/c), qRound(p.yp/c));
204 }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator/() [2/2]

const QPointF operator/ ( const QPointF p,
qreal  c 
)
inline

Definition at line 371 of file qpoint.h.

372 {
373  return QPointF(p.xp/c, p.yp/c);
374 }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254

◆ operator<<() [1/4]

Q_CORE_EXPORT QDataStream& operator<< ( QDataStream ,
const QPoint  
)
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

◆ operator<<() [2/4]

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QPoint  
)

Definition at line 495 of file qpoint.cpp.

495  {
496  dbg.nospace() << "QPoint(" << p.x() << ',' << p.y() << ')';
497  return dbg.space();
498 }

◆ operator<<() [3/4]

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

Definition at line 849 of file qpoint.cpp.

850 {
851  s << double(p.x()) << double(p.y());
852  return s;
853 }

◆ operator<<() [4/4]

Q_CORE_EXPORT 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==() [1/2]

bool operator== ( const QPoint p1,
const QPoint p2 
)
inline

Definition at line 161 of file qpoint.h.

162 { return p1.xp == p2.xp && p1.yp == p2.yp; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator==() [2/2]

bool operator== ( const QPointF p1,
const QPointF p2 
)
inline

Definition at line 329 of file qpoint.h.

330 {
331  return qFuzzyIsNull(p1.xp - p2.xp) && qFuzzyIsNull(p1.yp - p2.yp);
332 }
qreal xp
Definition: qpoint.h:253
qreal yp
Definition: qpoint.h:254
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043

◆ operator>>() [1/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QPoint  
)
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
short qint16
Definition: qglobal.h:935

◆ operator>>() [2/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QPointF  
)
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

◆ Q_DECLARE_TYPEINFO() [1/2]

Q_DECLARE_TYPEINFO ( QPoint  ,
Q_MOVABLE_TYPE   
)

◆ Q_DECLARE_TYPEINFO() [2/2]

Q_DECLARE_TYPEINFO ( QPointF  ,
Q_MOVABLE_TYPE   
)