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

Go to the source code of this file.

Classes

class  QSize
 The QSize class defines the size of a two-dimensional object using integer point precision. More...
 
class  QSizeF
 The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
 

Functions

bool operator!= (const QSize &s1, const QSize &s2)
 
bool operator!= (const QSizeF &s1, const QSizeF &s2)
 
const QSize operator* (const QSize &s, qreal c)
 
const QSize operator* (qreal c, const QSize &s)
 
const QSizeF operator* (const QSizeF &s, qreal c)
 
const QSizeF operator* (qreal c, const QSizeF &s)
 
const QSize operator+ (const QSize &s1, const QSize &s2)
 
const QSizeF operator+ (const QSizeF &s1, const QSizeF &s2)
 
const QSize operator- (const QSize &s1, const QSize &s2)
 
const QSizeF operator- (const QSizeF &s1, const QSizeF &s2)
 
const QSize operator/ (const QSize &s, qreal c)
 
const QSizeF operator/ (const QSizeF &s, qreal c)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QSize &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QSize &)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QSizeF &)
 
Q_CORE_EXPORT QDebug operator<< (QDebug, const QSizeF &)
 
bool operator== (const QSize &s1, const QSize &s2)
 
bool operator== (const QSizeF &s1, const QSizeF &s2)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QSize &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QSizeF &)
 
 Q_DECLARE_TYPEINFO (QSize, Q_MOVABLE_TYPE)
 
 Q_DECLARE_TYPEINFO (QSizeF, Q_MOVABLE_TYPE)
 

Function Documentation

◆ operator!=() [1/2]

bool operator!= ( const QSize s1,
const QSize s2 
)
inline

Definition at line 159 of file qsize.h.

160 { return s1.wd != s2.wd || s1.ht != s2.ht; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator!=() [2/2]

bool operator!= ( const QSizeF s1,
const QSizeF s2 
)
inline

Definition at line 317 of file qsize.h.

318 { return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht); }
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172

◆ operator*() [1/4]

const QSize operator* ( const QSize s,
qreal  c 
)
inline

Definition at line 168 of file qsize.h.

169 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int ht
Definition: qsize.h:93
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int wd
Definition: qsize.h:92
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [2/4]

const QSize operator* ( qreal  c,
const QSize s 
)
inline

Definition at line 171 of file qsize.h.

172 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
int ht
Definition: qsize.h:93
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int wd
Definition: qsize.h:92
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*() [3/4]

const QSizeF operator* ( const QSizeF s,
qreal  c 
)
inline

Definition at line 326 of file qsize.h.

327 { return QSizeF(s.wd*c, s.ht*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245

◆ operator*() [4/4]

const QSizeF operator* ( qreal  c,
const QSizeF s 
)
inline

Definition at line 329 of file qsize.h.

330 { return QSizeF(s.wd*c, s.ht*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245

◆ operator+() [1/2]

const QSize operator+ ( const QSize s1,
const QSize s2 
)
inline

Definition at line 162 of file qsize.h.

163 { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
int ht
Definition: qsize.h:93
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int wd
Definition: qsize.h:92

◆ operator+() [2/2]

const QSizeF operator+ ( const QSizeF s1,
const QSizeF s2 
)
inline

Definition at line 320 of file qsize.h.

321 { return QSizeF(s1.wd+s2.wd, s1.ht+s2.ht); }
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245

◆ operator-() [1/2]

const QSize operator- ( const QSize s1,
const QSize s2 
)
inline

Definition at line 165 of file qsize.h.

166 { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
int ht
Definition: qsize.h:93
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int wd
Definition: qsize.h:92

◆ operator-() [2/2]

const QSizeF operator- ( const QSizeF s1,
const QSizeF s2 
)
inline

Definition at line 323 of file qsize.h.

324 { return QSizeF(s1.wd-s2.wd, s1.ht-s2.ht); }
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245

◆ operator/() [1/2]

const QSize operator/ ( const QSize s,
qreal  c 
)
inline

Definition at line 181 of file qsize.h.

182 {
184  return QSize(qRound(s.wd/c), qRound(s.ht/c));
185 }
unsigned char c[8]
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int ht
Definition: qsize.h:93
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int wd
Definition: qsize.h:92
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator/() [2/2]

const QSizeF operator/ ( const QSizeF s,
qreal  c 
)
inline

Definition at line 339 of file qsize.h.

340 {
342  return QSizeF(s.wd/c, s.ht/c);
343 }
unsigned char c[8]
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043

◆ operator<<() [1/4]

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

Definition at line 461 of file qsize.cpp.

462 {
463  if (s.version() == 1)
464  s << (qint16)sz.width() << (qint16)sz.height();
465  else
466  s << (qint32)sz.width() << (qint32)sz.height();
467  return s;
468 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator<<() [2/4]

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QSize  
)

Definition at line 500 of file qsize.cpp.

500  {
501  dbg.nospace() << "QSize(" << s.width() << ", " << s.height() << ')';
502  return dbg.space();
503 }

◆ operator<<() [3/4]

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

Definition at line 953 of file qsize.cpp.

954 {
955  s << double(sz.width()) << double(sz.height());
956  return s;
957 }

◆ operator<<() [4/4]

Q_CORE_EXPORT QDebug operator<< ( QDebug  ,
const QSizeF  
)

Definition at line 984 of file qsize.cpp.

984  {
985  dbg.nospace() << "QSizeF(" << s.width() << ", " << s.height() << ')';
986  return dbg.space();
987 }

◆ operator==() [1/2]

bool operator== ( const QSize s1,
const QSize s2 
)
inline

Definition at line 156 of file qsize.h.

157 { return s1.wd == s2.wd && s1.ht == s2.ht; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator==() [2/2]

bool operator== ( const QSizeF s1,
const QSizeF s2 
)
inline

Definition at line 314 of file qsize.h.

315 { return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); }
qreal wd
Definition: qsize.h:244
qreal ht
Definition: qsize.h:245
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172

◆ operator>>() [1/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QSize  
)
related

Definition at line 483 of file qsize.cpp.

484 {
485  if (s.version() == 1) {
486  qint16 w, h;
487  s >> w; sz.rwidth() = w;
488  s >> h; sz.rheight() = h;
489  }
490  else {
491  qint32 w, h;
492  s >> w; sz.rwidth() = w;
493  s >> h; sz.rheight() = h;
494  }
495  return s;
496 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator>>() [2/2]

Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QSizeF  
)
related

Definition at line 972 of file qsize.cpp.

973 {
974  double w, h;
975  s >> w;
976  s >> h;
977  sz.setWidth(qreal(w));
978  sz.setHeight(qreal(h));
979  return s;
980 }
double qreal
Definition: qglobal.h:1193

◆ Q_DECLARE_TYPEINFO() [1/2]

Q_DECLARE_TYPEINFO ( QSize  ,
Q_MOVABLE_TYPE   
)

◆ Q_DECLARE_TYPEINFO() [2/2]

Q_DECLARE_TYPEINFO ( QSizeF  ,
Q_MOVABLE_TYPE   
)