src/corelib/tools/qpoint.h File Reference

#include <QtCore/qnamespace.h>

Include dependency graph for qpoint.h:

This graph shows which files directly or indirectly include this file:

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

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


Function Documentation

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

Definition at line 306 of file qpoint.h.

References p.

00307 {
00308     return QPointF(p.xp*c, p.yp*c);
00309 }

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

Definition at line 301 of file qpoint.h.

References p.

00302 {
00303     return QPointF(p.xp*c, p.yp*c);
00304 }

const QPoint operator * ( qreal  c,
const QPoint p 
) [inline]

Definition at line 141 of file qpoint.h.

References p, and qRound().

00142 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }

Here is the call graph for this function:

const QPoint operator * ( const QPoint p,
qreal  c 
) [inline]

Definition at line 138 of file qpoint.h.

References p, and qRound().

00139 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }

Here is the call graph for this function:

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

Definition at line 286 of file qpoint.h.

References QPointF::xp, and QPointF::yp.

00287 {
00288     return !qFuzzyCompare(p1.xp, p2.xp) || !qFuzzyCompare(p1.yp, p2.yp);
00289 }

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

Definition at line 129 of file qpoint.h.

References QPoint::xp, and QPoint::yp.

00130 { return p1.xp != p2.xp || p1.yp != p2.yp; }

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

Definition at line 291 of file qpoint.h.

References QPointF::xp, and QPointF::yp.

00292 {
00293     return QPointF(p1.xp+p2.xp, p1.yp+p2.yp);
00294 }

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

Definition at line 132 of file qpoint.h.

References QPoint::xp, and QPoint::yp.

00133 { return QPoint(p1.xp+p2.xp, p1.yp+p2.yp); }

const QPointF operator- ( const QPointF p  )  [inline]

Definition at line 311 of file qpoint.h.

References p.

00312 {
00313     return QPointF(-p.xp, -p.yp);
00314 }

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

Definition at line 296 of file qpoint.h.

References QPointF::xp, and QPointF::yp.

00297 {
00298     return QPointF(p1.xp-p2.xp, p1.yp-p2.yp);
00299 }

const QPoint operator- ( const QPoint p  )  [inline]

Definition at line 144 of file qpoint.h.

References p.

00145 { return QPoint(-p.xp, -p.yp); }

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

Definition at line 135 of file qpoint.h.

References QPoint::xp, and QPoint::yp.

00136 { return QPoint(p1.xp-p2.xp, p1.yp-p2.yp); }

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

Definition at line 324 of file qpoint.h.

References p.

00325 {
00326     Q_ASSERT(!qFuzzyCompare(c, 0));
00327     return QPointF(p.xp/c, p.yp/c);
00328 }

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

Definition at line 155 of file qpoint.h.

References p, and qRound().

00156 {
00157     Q_ASSERT(!qFuzzyCompare(c, 0));
00158     return QPoint(qRound(p.xp/c), qRound(p.yp/c));
00159 }

Here is the call graph for this function:

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

Definition at line 392 of file qpoint.cpp.

References d, and p.

00393 {
00394     d << "QPointF(" << p.x() << ", " << p.y() << ")";
00395     return d;
00396 }

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

Definition at line 682 of file qpoint.cpp.

References p, and s.

00683 {
00684     s << double(p.x()) << double(p.y());
00685     return s;
00686 }

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QPoint  
)

Definition at line 387 of file qpoint.cpp.

References QDebug::nospace(), p, and QDebug::space().

00387                                                {
00388     dbg.nospace() << "QPoint(" << p.x() << ',' << p.y() << ')';
00389     return dbg.space();
00390 }

Here is the call graph for this function:

Q_CORE_EXPORT QDataStream& operator<< ( QDataStream ,
const QPoint  
) [related]

Definition at line 319 of file qpoint.cpp.

References p, and s.

00320 {
00321     if (s.version() == 1)
00322         s << (qint16)p.x() << (qint16)p.y();
00323     else
00324         s << (qint32)p.x() << (qint32)p.y();
00325     return s;
00326 }

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

Definition at line 281 of file qpoint.h.

References QPointF::xp, and QPointF::yp.

00282 {
00283     return qFuzzyCompare(p1.xp, p2.xp) && qFuzzyCompare(p1.yp, p2.yp);
00284 }

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

Definition at line 126 of file qpoint.h.

References QPoint::xp, and QPoint::yp.

00127 { return p1.xp == p2.xp && p1.yp == p2.yp; }

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QPointF  
) [related]

Definition at line 698 of file qpoint.cpp.

References p, s, x, and y.

00699 {
00700     double x, y;
00701     s >> x;
00702     s >> y;
00703     p.setX(qreal(x));
00704     p.setY(qreal(y));
00705     return s;
00706 }

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QPoint  
) [related]

Definition at line 338 of file qpoint.cpp.

References p, s, x, and y.

00339 {
00340     if (s.version() == 1) {
00341         qint16 x, y;
00342         s >> x;  p.rx() = x;
00343         s >> y;  p.ry() = y;
00344     }
00345     else {
00346         qint32 x, y;
00347         s >> x;  p.rx() = x;
00348         s >> y;  p.ry() = y;
00349     }
00350     return s;
00351 }

Q_DECLARE_TYPEINFO ( QPointF  ,
Q_MOVABLE_TYPE   
)

Q_DECLARE_TYPEINFO ( QPoint  ,
Q_MOVABLE_TYPE   
)


Generated on Thu Mar 15 13:09:02 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1